diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-12 01:03:02 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-12 01:03:02 +0800 |
commit | 04367ead7027e9f0359d24681f5cc0dd916b934d (patch) | |
tree | f2a277ac9d53863c9f4efc8099450138974bdb4d /include/cru/ui/controls | |
parent | 86e776eaebf7c45a269001ca7da0dfafba069d0a (diff) | |
download | cru-04367ead7027e9f0359d24681f5cc0dd916b934d.tar.gz cru-04367ead7027e9f0359d24681f5cc0dd916b934d.tar.bz2 cru-04367ead7027e9f0359d24681f5cc0dd916b934d.zip |
...
Diffstat (limited to 'include/cru/ui/controls')
-rw-r--r-- | include/cru/ui/controls/button.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/cru/ui/controls/button.hpp b/include/cru/ui/controls/button.hpp index 648bb6bc..ca3dcae9 100644 --- a/include/cru/ui/controls/button.hpp +++ b/include/cru/ui/controls/button.hpp @@ -1,10 +1,10 @@ #pragma once #include "../content_control.hpp" +#include "../click_detector.hpp" +#include "../render/border_render_object.hpp" #include "cru/platform/graph/brush.hpp" #include "cru/platform/native/basic_types.hpp" -#include "cru/ui/base.hpp" -#include "cru/ui/render/border_render_object.hpp" #include <memory> @@ -94,13 +94,11 @@ class Button : public ContentControl { protected: void OnChildChanged(Control* old_child, Control* new_child) override; - void OnMouseClickBegin(platform::native::MouseButton button) override; - void OnMouseClickEnd(platform::native::MouseButton button) override; - virtual void OnStateChange(ButtonState oldState, ButtonState newState); private: void SetState(ButtonState newState) { + if (state_ == newState) return; const auto oldState = state_; state_ = newState; OnStateChange(oldState, newState); @@ -114,5 +112,7 @@ class Button : public ContentControl { MouseButton trigger_button_ = MouseButton::Left; ButtonBorderStyle border_style_; + + ClickDetector click_detector_; }; } // namespace cru::ui::controls |