| 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 24 matching lines...) Expand all Loading... |
| 35 static const CustomButton* AsCustomButton(const View* view); | 35 static const CustomButton* AsCustomButton(const View* view); |
| 36 static CustomButton* AsCustomButton(View* view); | 36 static CustomButton* AsCustomButton(View* view); |
| 37 | 37 |
| 38 ~CustomButton() override; | 38 ~CustomButton() override; |
| 39 | 39 |
| 40 // Get/sets the current display state of the button. | 40 // Get/sets the current display state of the button. |
| 41 ButtonState state() const { return state_; } | 41 ButtonState state() const { return state_; } |
| 42 void SetState(ButtonState state); | 42 void SetState(ButtonState state); |
| 43 | 43 |
| 44 // Starts throbbing. See HoverAnimation for a description of cycles_til_stop. | 44 // Starts throbbing. See HoverAnimation for a description of cycles_til_stop. |
| 45 // This method does nothing if |animate_on_state_change_| is false. |
| 45 void StartThrobbing(int cycles_til_stop); | 46 void StartThrobbing(int cycles_til_stop); |
| 46 | 47 |
| 47 // Stops throbbing immediately. | 48 // Stops throbbing immediately. |
| 48 void StopThrobbing(); | 49 void StopThrobbing(); |
| 49 | 50 |
| 50 // Set how long the hover animation will last for. | 51 // Set how long the hover animation will last for. |
| 51 void SetAnimationDuration(int duration); | 52 void SetAnimationDuration(int duration); |
| 52 | 53 |
| 53 void set_triggerable_event_flags(int triggerable_event_flags) { | 54 void set_triggerable_event_flags(int triggerable_event_flags) { |
| 54 triggerable_event_flags_ = triggerable_event_flags; | 55 triggerable_event_flags_ = triggerable_event_flags; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 const gfx::ThrobAnimation& hover_animation() const { | 160 const gfx::ThrobAnimation& hover_animation() const { |
| 160 return hover_animation_; | 161 return hover_animation_; |
| 161 } | 162 } |
| 162 | 163 |
| 163 private: | 164 private: |
| 164 ButtonState state_; | 165 ButtonState state_; |
| 165 | 166 |
| 166 gfx::ThrobAnimation hover_animation_; | 167 gfx::ThrobAnimation hover_animation_; |
| 167 | 168 |
| 168 // Should we animate when the state changes? Defaults to true. | 169 // Should we animate when the state changes? |
| 169 bool animate_on_state_change_; | 170 bool animate_on_state_change_ = false; |
| 170 | 171 |
| 171 // Is the hover animation running because StartThrob was invoked? | 172 // Is the hover animation running because StartThrob was invoked? |
| 172 bool is_throbbing_; | 173 bool is_throbbing_; |
| 173 | 174 |
| 174 // Mouse event flags which can trigger button actions. | 175 // Mouse event flags which can trigger button actions. |
| 175 int triggerable_event_flags_; | 176 int triggerable_event_flags_; |
| 176 | 177 |
| 177 // See description above setter. | 178 // See description above setter. |
| 178 bool request_focus_on_press_; | 179 bool request_focus_on_press_; |
| 179 | 180 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 190 | 191 |
| 191 // The color of the ripple and hover. | 192 // The color of the ripple and hover. |
| 192 SkColor ink_drop_base_color_; | 193 SkColor ink_drop_base_color_; |
| 193 | 194 |
| 194 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 195 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 195 }; | 196 }; |
| 196 | 197 |
| 197 } // namespace views | 198 } // namespace views |
| 198 | 199 |
| 199 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 200 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |