예제 #1
0
	void HScrollBar::setValue( int val )
	{
		//store current value to compare later
		int targetVal = val;

		//perform bounds checking
		if (val <= getMinValue())
		{
			targetVal = getMinValue();
		}
		else if(val >= getMaxValue() - getLargeAmount())
		{

			targetVal = getMaxValue() - getLargeAmount();
		}


		//only reposition if there is a change
		if(targetVal != currentValue)
		{
			currentValue = targetVal;
			positionThumb();

			for(std::vector<HScrollBarListener*>::iterator it = 
				hScrollListeners.begin();
				it != hScrollListeners.end(); ++it)
			{
				if((*it))
					(*it)->valueChanged(this,currentValue);
			}

			dispatchActionEvent(ActionEvent(this));
		}
	}
예제 #2
0
	void TextField::keyDown( KeyEvent &keyEvent )
	{
		handleKeyboard(keyEvent);
		if(keyEvent.getKey() == KEY_ENTER)
		{
			dispatchActionEvent(ActionEvent(this));
		}
			keyEvent.consume();
	}
예제 #3
0
파일: Button.cpp 프로젝트: arvidsson/Agui
	void Button::mouseClick( MouseEvent &mouseEvent )
	{
		if(isToggleButton() && mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			handleToggleClick();
			mouseEvent.consume();
		}

		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		dispatchActionEvent(ActionEvent(this));
	}
예제 #4
0
	void RadioButton::keyUp( KeyEvent &keyEvent )
	{
		if(!isDoingKeyAction)
		{
			return;
		}
		isDoingKeyAction = false;
		if(keyEvent.getKey() == KEY_SPACE || keyEvent.getKey() == KEY_ENTER)
		{
			dispatchActionEvent(ActionEvent(
				this));
			modifyRadioButtonState();
			nextCheckState();
			keyEvent.consume();
		}
	}
예제 #5
0
파일: Button.cpp 프로젝트: arvidsson/Agui
	void Button::keyUp( KeyEvent &keyEvent )
	{
		if(!isDoingKeyAction)
		{
			return;
		}
		isDoingKeyAction = false;
		if(keyEvent.getKey() == KEY_SPACE || keyEvent.getKey() == KEY_ENTER)
		{
			dispatchActionEvent(ActionEvent(
				this));
			handleToggleClick();
			modifyButtonState();

			keyEvent.consume();
		}
	}
예제 #6
0
	void RadioButton::changeCheckedState( RadioButtonCheckedEnum state )
	{
		if(state == checkedState)
		{
			return;
		}
		checkedState = state;

		for(std::vector<RadioButtonListener*>::iterator it = 
			radioButtonListeners.begin();
			it != radioButtonListeners.end(); ++it)
		{
			if((*it))
				(*it)->checkedStateChanged(this,state);
		}

		if(checkedState == CHECKED)
		dispatchActionEvent(ActionEvent(this));
	}