diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/custom_button.cc | 14 | ||||
-rw-r--r-- | views/controls/button/custom_button.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index f9a58f6..c7eadca 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -219,6 +219,20 @@ void CustomButton::ViewHierarchyChanged(bool is_add, View *parent, SetState(BS_NORMAL); } +void CustomButton::SetHotTracked(bool flag) { + if (state_ != BS_DISABLED) + SetState(flag ? BS_HOT : BS_NORMAL); +} + +bool CustomButton::IsHotTracked() const { + return state_ == BS_HOT; +} + +void CustomButton::WillLoseFocus() { + if (IsHotTracked()) + SetState(BS_NORMAL); +} + //////////////////////////////////////////////////////////////////////////////// // CustomButton, AnimationDelegate implementation: diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h index 75cb29b..bd43d4d 100644 --- a/views/controls/button/custom_button.h +++ b/views/controls/button/custom_button.h @@ -72,6 +72,9 @@ class CustomButton : public Button, virtual void OnDragDone(); virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture); virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); + virtual void SetHotTracked(bool flag); + virtual bool IsHotTracked() const; + virtual void WillLoseFocus(); // Overridden from AnimationDelegate: virtual void AnimationProgressed(const Animation* animation); |