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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Invoked from SetState() when SetState() is passed a value that differs from | 144 // Invoked from SetState() when SetState() is passed a value that differs from |
145 // the current node_data. CustomButton's implementation of StateChanged() does | 145 // the current node_data. CustomButton's implementation of StateChanged() does |
146 // nothing; this method is provided for subclasses that wish to do something | 146 // nothing; this method is provided for subclasses that wish to do something |
147 // on state changes. | 147 // on state changes. |
148 virtual void StateChanged(ButtonState old_state); | 148 virtual void StateChanged(ButtonState old_state); |
149 | 149 |
150 // Returns true if the event is one that can trigger notifying the listener. | 150 // Returns true if the event is one that can trigger notifying the listener. |
151 // This implementation returns true if the left mouse button is down. | 151 // This implementation returns true if the left mouse button is down. |
152 virtual bool IsTriggerableEvent(const ui::Event& event); | 152 virtual bool IsTriggerableEvent(const ui::Event& event); |
153 | 153 |
| 154 // Returns true if the ink drop should be updated by CustomButton when |
| 155 // OnClickCanceled() is called. This method is provided for subclasses. |
| 156 virtual bool ShouldUpdateInkDropOnClickCanceled() const; |
| 157 |
154 // Returns true if the button should become pressed when the user | 158 // Returns true if the button should become pressed when the user |
155 // holds the mouse down over the button. For this implementation, | 159 // holds the mouse down over the button. For this implementation, |
156 // we simply return IsTriggerableEvent(event). | 160 // we simply return IsTriggerableEvent(event). |
157 virtual bool ShouldEnterPushedState(const ui::Event& event); | 161 virtual bool ShouldEnterPushedState(const ui::Event& event); |
158 | 162 |
159 // Returns true if the button should enter hovered state; that is, if the | 163 // Returns true if the button should enter hovered state; that is, if the |
160 // mouse is over the button, and no other window has capture (which would | 164 // mouse is over the button, and no other window has capture (which would |
161 // prevent the button from receiving MouseExited events and updating its | 165 // prevent the button from receiving MouseExited events and updating its |
162 // node_data). This does not take into account enabled node_data. | 166 // node_data). This does not take into account enabled node_data. |
163 bool ShouldEnterHoveredState(); | 167 bool ShouldEnterHoveredState(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 204 |
201 // The color of the ripple and hover. | 205 // The color of the ripple and hover. |
202 SkColor ink_drop_base_color_; | 206 SkColor ink_drop_base_color_; |
203 | 207 |
204 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 208 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
205 }; | 209 }; |
206 | 210 |
207 } // namespace views | 211 } // namespace views |
208 | 212 |
209 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 213 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
OLD | NEW |