OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
6 #define VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/animation.h" | 9 #include "app/animation.h" |
10 #include "views/controls/button/button.h" | 10 #include "views/controls/button/button.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return triggerable_event_flags_; | 56 return triggerable_event_flags_; |
57 } | 57 } |
58 | 58 |
59 // Sets whether |RequestFocus| should be invoked on a mouse press. The default | 59 // Sets whether |RequestFocus| should be invoked on a mouse press. The default |
60 // is true. | 60 // is true. |
61 void set_request_focus_on_press(bool value) { | 61 void set_request_focus_on_press(bool value) { |
62 request_focus_on_press_ = value; | 62 request_focus_on_press_ = value; |
63 } | 63 } |
64 bool request_focus_on_press() const { return request_focus_on_press_; } | 64 bool request_focus_on_press() const { return request_focus_on_press_; } |
65 | 65 |
| 66 // Returns true if the mouse pointer is over this control. Note that this |
| 67 // isn't the same as IsHotTracked() because the mouse may be over the control |
| 68 // when it's disabled. |
| 69 bool IsMouseHovered() const; |
| 70 |
66 protected: | 71 protected: |
67 // Construct the Button with a Listener. See comment for Button's ctor. | 72 // Construct the Button with a Listener. See comment for Button's ctor. |
68 explicit CustomButton(ButtonListener* listener); | 73 explicit CustomButton(ButtonListener* listener); |
69 | 74 |
70 // Returns true if the event is one that can trigger notifying the listener. | 75 // Returns true if the event is one that can trigger notifying the listener. |
71 // This implementation returns true if the left mouse button is down. | 76 // This implementation returns true if the left mouse button is down. |
72 virtual bool IsTriggerableEvent(const MouseEvent& e); | 77 virtual bool IsTriggerableEvent(const MouseEvent& e); |
73 | 78 |
74 // Overridden from View: | 79 // Overridden from View: |
75 virtual bool AcceleratorPressed(const Accelerator& accelerator); | 80 virtual bool AcceleratorPressed(const Accelerator& accelerator); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 117 |
113 // See description above setter. | 118 // See description above setter. |
114 bool request_focus_on_press_; | 119 bool request_focus_on_press_; |
115 | 120 |
116 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 121 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
117 }; | 122 }; |
118 | 123 |
119 } // namespace views | 124 } // namespace views |
120 | 125 |
121 #endif // VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 126 #endif // VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
OLD | NEW |