diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-20 20:04:39 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-20 20:04:39 +0100 |
commit | 299f6ef8499bb3ee4ada5d63dc71091fddcb39c6 (patch) | |
tree | b7fdf5b33af017d5e38d8df1aed2d8017e930cfd /plugingui/checkbox.h | |
parent | 01b32ebab05428d3cd57ca72d2db1f0c431e007f (diff) |
Improve behaviour when holding the mouse down and moving it in and out of the checkbox.
Diffstat (limited to 'plugingui/checkbox.h')
-rw-r--r-- | plugingui/checkbox.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugingui/checkbox.h b/plugingui/checkbox.h index 093c5c3..927bf6d 100644 --- a/plugingui/checkbox.h +++ b/plugingui/checkbox.h @@ -40,6 +40,7 @@ public: // From Widget: bool isFocusable() override { return true; } + bool catchMouse() override { return true; } bool checked(); void setChecked(bool checked); @@ -47,12 +48,12 @@ public: Notifier<bool> stateChangedNotifier; protected: - virtual void clicked() {} - // From Widget: virtual void repaintEvent(RepaintEvent* repaintEvent) override; virtual void buttonEvent(ButtonEvent* buttonEvent) override; virtual void keyEvent(KeyEvent* keyEvent) override; + virtual void mouseLeaveEvent() override; + virtual void mouseEnterEvent() override; private: void internalSetChecked(bool checked); @@ -63,6 +64,8 @@ private: bool state; bool middle; + bool buttonDown = false; + bool inCheckbox = false; std::string _text; }; |