| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 notify_action_ = notify_action; | 90 notify_action_ = notify_action; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void set_hide_ink_drop_when_showing_context_menu( | 93 void set_hide_ink_drop_when_showing_context_menu( |
| 94 bool hide_ink_drop_when_showing_context_menu) { | 94 bool hide_ink_drop_when_showing_context_menu) { |
| 95 hide_ink_drop_when_showing_context_menu_ = | 95 hide_ink_drop_when_showing_context_menu_ = |
| 96 hide_ink_drop_when_showing_context_menu; | 96 hide_ink_drop_when_showing_context_menu; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void set_ink_drop_base_color(SkColor color) { ink_drop_base_color_ = color; } | 99 void set_ink_drop_base_color(SkColor color) { ink_drop_base_color_ = color; } |
| 100 void set_has_ink_drop_action_on_click(bool has_ink_drop_action_on_click) { |
| 101 has_ink_drop_action_on_click_ = has_ink_drop_action_on_click; |
| 102 } |
| 100 | 103 |
| 101 void SetHotTracked(bool is_hot_tracked); | 104 void SetHotTracked(bool is_hot_tracked); |
| 102 bool IsHotTracked() const; | 105 bool IsHotTracked() const; |
| 103 | 106 |
| 104 // Overridden from View: | 107 // Overridden from View: |
| 105 void OnEnabledChanged() override; | 108 void OnEnabledChanged() override; |
| 106 const char* GetClassName() const override; | 109 const char* GetClassName() const override; |
| 107 bool OnMousePressed(const ui::MouseEvent& event) override; | 110 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 108 bool OnMouseDragged(const ui::MouseEvent& event) override; | 111 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 109 void OnMouseReleased(const ui::MouseEvent& event) override; | 112 void OnMouseReleased(const ui::MouseEvent& event) override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 149 |
| 147 // 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. |
| 148 // This implementation returns true if the left mouse button is down. | 151 // This implementation returns true if the left mouse button is down. |
| 149 virtual bool IsTriggerableEvent(const ui::Event& event); | 152 virtual bool IsTriggerableEvent(const ui::Event& event); |
| 150 | 153 |
| 151 // Returns true if the button should become pressed when the user | 154 // Returns true if the button should become pressed when the user |
| 152 // holds the mouse down over the button. For this implementation, | 155 // holds the mouse down over the button. For this implementation, |
| 153 // we simply return IsTriggerableEvent(event). | 156 // we simply return IsTriggerableEvent(event). |
| 154 virtual bool ShouldEnterPushedState(const ui::Event& event); | 157 virtual bool ShouldEnterPushedState(const ui::Event& event); |
| 155 | 158 |
| 156 void set_has_ink_drop_action_on_click(bool has_ink_drop_action_on_click) { | |
| 157 has_ink_drop_action_on_click_ = has_ink_drop_action_on_click; | |
| 158 } | |
| 159 | |
| 160 // Returns true if the button should enter hovered state; that is, if the | 159 // Returns true if the button should enter hovered state; that is, if the |
| 161 // mouse is over the button, and no other window has capture (which would | 160 // mouse is over the button, and no other window has capture (which would |
| 162 // prevent the button from receiving MouseExited events and updating its | 161 // prevent the button from receiving MouseExited events and updating its |
| 163 // node_data). This does not take into account enabled node_data. | 162 // node_data). This does not take into account enabled node_data. |
| 164 bool ShouldEnterHoveredState(); | 163 bool ShouldEnterHoveredState(); |
| 165 | 164 |
| 166 // Overridden from Button: | 165 // Overridden from Button: |
| 167 void NotifyClick(const ui::Event& event) override; | 166 void NotifyClick(const ui::Event& event) override; |
| 168 void OnClickCanceled(const ui::Event& event) override; | 167 void OnClickCanceled(const ui::Event& event) override; |
| 169 | 168 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 200 |
| 202 // The color of the ripple and hover. | 201 // The color of the ripple and hover. |
| 203 SkColor ink_drop_base_color_; | 202 SkColor ink_drop_base_color_; |
| 204 | 203 |
| 205 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 204 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 } // namespace views | 207 } // namespace views |
| 209 | 208 |
| 210 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 209 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |