OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Takes ownership of the delegate. | 92 // Takes ownership of the delegate. |
93 void set_state_changed_delegate(CustomButtonStateChangedDelegate* delegate) { | 93 void set_state_changed_delegate(CustomButtonStateChangedDelegate* delegate) { |
94 state_changed_delegate_.reset(delegate); | 94 state_changed_delegate_.reset(delegate); |
95 } | 95 } |
96 | 96 |
97 protected: | 97 protected: |
98 // Construct the Button with a Listener. See comment for Button's ctor. | 98 // Construct the Button with a Listener. See comment for Button's ctor. |
99 explicit CustomButton(ButtonListener* listener); | 99 explicit CustomButton(ButtonListener* listener); |
100 | 100 |
| 101 // Returns whether or not the button should respond to mouse events. This |
| 102 // could be false if e.g. the button is showing a menu and wants to remain |
| 103 // pressed. |
| 104 // This is checked for mouse movement (OnMouse[Entered|Exited|Moved]) only; |
| 105 // other mouse events (like OnMousePressed) are still processed normally. |
| 106 // Defaults to true. |
| 107 virtual bool ShouldRespondToMouseMovement(); |
| 108 |
101 // Invoked from SetState() when SetState() is passed a value that differs from | 109 // Invoked from SetState() when SetState() is passed a value that differs from |
102 // the current state. CustomButton's implementation of StateChanged() does | 110 // the current state. CustomButton's implementation of StateChanged() does |
103 // nothing; this method is provided for subclasses that wish to do something | 111 // nothing; this method is provided for subclasses that wish to do something |
104 // on state changes. | 112 // on state changes. |
105 virtual void StateChanged(); | 113 virtual void StateChanged(); |
106 | 114 |
107 // Returns true if the event is one that can trigger notifying the listener. | 115 // Returns true if the event is one that can trigger notifying the listener. |
108 // This implementation returns true if the left mouse button is down. | 116 // This implementation returns true if the left mouse button is down. |
109 virtual bool IsTriggerableEvent(const ui::Event& event); | 117 virtual bool IsTriggerableEvent(const ui::Event& event); |
110 | 118 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 protected: | 159 protected: |
152 CustomButtonStateChangedDelegate() {} | 160 CustomButtonStateChangedDelegate() {} |
153 | 161 |
154 private: | 162 private: |
155 DISALLOW_COPY_AND_ASSIGN(CustomButtonStateChangedDelegate); | 163 DISALLOW_COPY_AND_ASSIGN(CustomButtonStateChangedDelegate); |
156 }; | 164 }; |
157 | 165 |
158 } // namespace views | 166 } // namespace views |
159 | 167 |
160 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 168 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
OLD | NEW |