|
@@ -59,18 +59,14 @@ struct ButtonEventHandler::PrivateData { |
|
|
const int state2 = state; |
|
|
const int state2 = state; |
|
|
state &= ~kButtonStateActive; |
|
|
state &= ~kButtonStateActive; |
|
|
|
|
|
|
|
|
|
|
|
self->stateChanged(static_cast<State>(state), static_cast<State>(state2)); |
|
|
|
|
|
widget->repaint(); |
|
|
|
|
|
|
|
|
// cursor was moved outside the button bounds, ignore click |
|
|
// cursor was moved outside the button bounds, ignore click |
|
|
if (! widget->contains(ev.pos)) |
|
|
if (! widget->contains(ev.pos)) |
|
|
{ |
|
|
|
|
|
self->stateChanged(static_cast<State>(state), static_cast<State>(state2)); |
|
|
|
|
|
widget->repaint(); |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// still on bounds, register click |
|
|
// still on bounds, register click |
|
|
self->stateChanged(static_cast<State>(state), static_cast<State>(state2)); |
|
|
|
|
|
widget->repaint(); |
|
|
|
|
|
|
|
|
|
|
|
if (checkable) |
|
|
if (checkable) |
|
|
checked = !checked; |
|
|
checked = !checked; |
|
|
|
|
|
|
|
@@ -217,6 +213,11 @@ void ButtonEventHandler::setCheckable(const bool checkable) noexcept |
|
|
pData->checkable = checkable; |
|
|
pData->checkable = checkable; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Point<double> ButtonEventHandler::getLastMotionPosition() const noexcept |
|
|
|
|
|
{ |
|
|
|
|
|
return pData->oldMotionPos; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void ButtonEventHandler::setCallback(Callback* const callback) noexcept |
|
|
void ButtonEventHandler::setCallback(Callback* const callback) noexcept |
|
|
{ |
|
|
{ |
|
|
pData->userCallback = callback; |
|
|
pData->userCallback = callback; |
|
|