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 "ui/base/animation/animation_delegate.h" | 8 #include "ui/base/animation/animation_delegate.h" |
9 #include "ui/base/events.h" | 9 #include "ui/base/events.h" |
10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 explicit CustomButton(ButtonListener* listener); | 102 explicit CustomButton(ButtonListener* listener); |
103 | 103 |
104 // Invoked from SetState() when SetState() is passed a value that differs from | 104 // Invoked from SetState() when SetState() is passed a value that differs from |
105 // the current state. CustomButton's implementation of StateChanged() does | 105 // the current state. CustomButton's implementation of StateChanged() does |
106 // nothing; this method is provided for subclasses that wish to do something | 106 // nothing; this method is provided for subclasses that wish to do something |
107 // on state changes. | 107 // on state changes. |
108 virtual void StateChanged(); | 108 virtual void StateChanged(); |
109 | 109 |
110 // Returns true if the event is one that can trigger notifying the listener. | 110 // Returns true if the event is one that can trigger notifying the listener. |
111 // This implementation returns true if the left mouse button is down. | 111 // This implementation returns true if the left mouse button is down. |
112 virtual bool IsTriggerableEvent(const Event& event); | 112 virtual bool IsTriggerableEvent(const ui::Event& event); |
113 | 113 |
114 // Returns true if the button should become pressed when the user | 114 // Returns true if the button should become pressed when the user |
115 // holds the mouse down over the button. For this implementation, | 115 // holds the mouse down over the button. For this implementation, |
116 // we simply return IsTriggerableEvent(event). | 116 // we simply return IsTriggerableEvent(event). |
117 virtual bool ShouldEnterPushedState(const Event& event); | 117 virtual bool ShouldEnterPushedState(const ui::Event& event); |
118 | 118 |
119 // Overridden from View: | 119 // Overridden from View: |
120 virtual void ViewHierarchyChanged(bool is_add, | 120 virtual void ViewHierarchyChanged(bool is_add, |
121 View* parent, | 121 View* parent, |
122 View* child) OVERRIDE; | 122 View* child) OVERRIDE; |
123 virtual void OnBlur() OVERRIDE; | 123 virtual void OnBlur() OVERRIDE; |
124 | 124 |
125 // The button state (defined in implementation) | 125 // The button state (defined in implementation) |
126 ButtonState state_; | 126 ButtonState state_; |
127 | 127 |
(...skipping 12 matching lines...) Expand all Loading... |
140 | 140 |
141 // See description above setter. | 141 // See description above setter. |
142 bool request_focus_on_press_; | 142 bool request_focus_on_press_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 144 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
145 }; | 145 }; |
146 | 146 |
147 } // namespace views | 147 } // namespace views |
148 | 148 |
149 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 149 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
OLD | NEW |