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