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)); } }
void TextField::keyDown( KeyEvent &keyEvent ) { handleKeyboard(keyEvent); if(keyEvent.getKey() == KEY_ENTER) { dispatchActionEvent(ActionEvent(this)); } keyEvent.consume(); }
void Button::mouseClick( MouseEvent &mouseEvent ) { if(isToggleButton() && mouseEvent.getButton() == MOUSE_BUTTON_LEFT) { handleToggleClick(); mouseEvent.consume(); } if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT) dispatchActionEvent(ActionEvent(this)); }
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(); } }
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(); } }
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)); }