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 // If the method is overriden and returns false, the subclass is responsible |
| 157 // will be responsible for updating the ink drop. |
| 158 virtual bool ShouldUpdateInkDropOnClickCanceled() const; |
| 159 |
154 // Returns true if the button should become pressed when the user | 160 // Returns true if the button should become pressed when the user |
155 // holds the mouse down over the button. For this implementation, | 161 // holds the mouse down over the button. For this implementation, |
156 // we simply return IsTriggerableEvent(event). | 162 // we simply return IsTriggerableEvent(event). |
157 virtual bool ShouldEnterPushedState(const ui::Event& event); | 163 virtual bool ShouldEnterPushedState(const ui::Event& event); |
158 | 164 |
159 // Returns true if the button should enter hovered state; that is, if the | 165 // 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 | 166 // mouse is over the button, and no other window has capture (which would |
161 // prevent the button from receiving MouseExited events and updating its | 167 // prevent the button from receiving MouseExited events and updating its |
162 // node_data). This does not take into account enabled node_data. | 168 // node_data). This does not take into account enabled node_data. |
163 bool ShouldEnterHoveredState(); | 169 bool ShouldEnterHoveredState(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 206 |
201 // The color of the ripple and hover. | 207 // The color of the ripple and hover. |
202 SkColor ink_drop_base_color_; | 208 SkColor ink_drop_base_color_; |
203 | 209 |
204 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 210 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
205 }; | 211 }; |
206 | 212 |
207 } // namespace views | 213 } // namespace views |
208 | 214 |
209 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 215 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
OLD | NEW |