Add support for wxEVT_SPIN_[UP|DOWN] events
This commit is contained in:
@@ -20,6 +20,7 @@ public:
|
||||
|
||||
private:
|
||||
void valueChanged(int value);
|
||||
virtual void stepBy(int steps) wxOVERRIDE; // see QAbstractSpinBox::stepBy()
|
||||
};
|
||||
|
||||
wxQtSpinButton::wxQtSpinButton( wxWindow *parent, wxSpinButton *handler )
|
||||
@@ -40,6 +41,26 @@ void wxQtSpinButton::valueChanged(int value)
|
||||
}
|
||||
}
|
||||
|
||||
void wxQtSpinButton::stepBy(int steps)
|
||||
{
|
||||
wxSpinButton* handler = GetHandler();
|
||||
if ( !handler )
|
||||
return;
|
||||
|
||||
int eventType = (steps < 0) ? wxEVT_SPIN_DOWN : wxEVT_SPIN_UP;
|
||||
wxSpinEvent directionEvent(eventType, handler->GetId());
|
||||
directionEvent.SetPosition(value());
|
||||
directionEvent.SetInt(value() + steps * singleStep());
|
||||
directionEvent.SetEventObject(handler);
|
||||
|
||||
handler->HandleWindowEvent(directionEvent); // should return value be checked here?
|
||||
|
||||
if ( directionEvent.IsAllowed() )
|
||||
{
|
||||
QSpinBox::stepBy(steps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxSpinButton::wxSpinButton() :
|
||||
m_qtSpinBox(NULL)
|
||||
|
Reference in New Issue
Block a user