Chromium Code Reviews| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 void set_has_ink_drop_action_on_click(bool has_ink_drop_action_on_click) { | 145 void set_has_ink_drop_action_on_click(bool has_ink_drop_action_on_click) { |
| 146 has_ink_drop_action_on_click_ = has_ink_drop_action_on_click; | 146 has_ink_drop_action_on_click_ = has_ink_drop_action_on_click; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Returns true if the button should enter hovered state; that is, if the | 149 // Returns true if the button should enter hovered state; that is, if the |
| 150 // mouse is over the button, and no other window has capture (which would | 150 // mouse is over the button, and no other window has capture (which would |
| 151 // prevent the button from receiving MouseExited events and updating its | 151 // prevent the button from receiving MouseExited events and updating its |
| 152 // state). This does not take into account enabled state. | 152 // state). This does not take into account enabled state. |
| 153 bool ShouldEnterHoveredState(); | 153 bool ShouldEnterHoveredState(); |
| 154 | 154 |
| 155 void set_animates_hover(bool animates) { animates_hover_ = animates; } | |
| 156 bool animates_hover() { return animates_hover_; } | |
| 157 | |
| 155 // Overridden from Button: | 158 // Overridden from Button: |
| 156 void NotifyClick(const ui::Event& event) override; | 159 void NotifyClick(const ui::Event& event) override; |
| 157 void OnClickCanceled(const ui::Event& event) override; | 160 void OnClickCanceled(const ui::Event& event) override; |
| 158 | 161 |
| 159 const gfx::ThrobAnimation& hover_animation() const { | 162 const gfx::ThrobAnimation& hover_animation() const { |
| 160 return hover_animation_; | 163 return hover_animation_; |
| 161 } | 164 } |
| 162 | 165 |
| 163 private: | 166 private: |
| 164 ButtonState state_; | 167 ButtonState state_; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 184 // ink_drop_delegate(). | 187 // ink_drop_delegate(). |
| 185 bool has_ink_drop_action_on_click_; | 188 bool has_ink_drop_action_on_click_; |
| 186 | 189 |
| 187 // When true, the ink drop ripple and hover will be hidden prior to showing | 190 // When true, the ink drop ripple and hover will be hidden prior to showing |
| 188 // the context menu. | 191 // the context menu. |
| 189 bool hide_ink_drop_when_showing_context_menu_; | 192 bool hide_ink_drop_when_showing_context_menu_; |
| 190 | 193 |
| 191 // The color of the ripple and hover. | 194 // The color of the ripple and hover. |
| 192 SkColor ink_drop_base_color_; | 195 SkColor ink_drop_base_color_; |
| 193 | 196 |
| 197 // Whether this button has a hover effect. If this returns true, painting the | |
|
sky
2016/10/11 19:17:45
As you mentioned previously, it seems wrong that a
| |
| 198 // button is taken to be dependent on the animation state and SchedulePaint() | |
| 199 // is called as the hover animation progresses. | |
| 200 bool animates_hover_ = false; | |
| 201 | |
| 194 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 202 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 195 }; | 203 }; |
| 196 | 204 |
| 197 } // namespace views | 205 } // namespace views |
| 198 | 206 |
| 199 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 207 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |