| 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" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
| 13 #include "ui/gfx/animation/animation_delegate.h" | 13 #include "ui/gfx/animation/animation_delegate.h" |
| 14 #include "ui/gfx/animation/throb_animation.h" | 14 #include "ui/gfx/animation/throb_animation.h" |
| 15 #include "ui/views/animation/ink_drop_state.h" | 15 #include "ui/views/animation/ink_drop_state.h" |
| 16 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 | 19 |
| 20 class InkDropDelegate; | |
| 21 | |
| 22 // A button with custom rendering. The base of ImageButton and LabelButton. | 20 // A button with custom rendering. The base of ImageButton and LabelButton. |
| 23 // Note that this type of button is not focusable by default and will not be | 21 // Note that this type of button is not focusable by default and will not be |
| 24 // part of the focus chain, unless in accessibility mode. Call | 22 // part of the focus chain, unless in accessibility mode. Call |
| 25 // SetFocusForPlatform() to make it part of the focus chain. | 23 // SetFocusForPlatform() to make it part of the focus chain. |
| 26 class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate { | 24 class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate { |
| 27 public: | 25 public: |
| 28 // An enum describing the events on which a button should notify its listener. | 26 // An enum describing the events on which a button should notify its listener. |
| 29 enum NotifyAction { | 27 enum NotifyAction { |
| 30 NOTIFY_ON_PRESS, | 28 NOTIFY_ON_PRESS, |
| 31 NOTIFY_ON_RELEASE, | 29 NOTIFY_ON_RELEASE, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 int triggerable_event_flags_; | 175 int triggerable_event_flags_; |
| 178 | 176 |
| 179 // See description above setter. | 177 // See description above setter. |
| 180 bool request_focus_on_press_; | 178 bool request_focus_on_press_; |
| 181 | 179 |
| 182 // The event on which the button should notify its listener. | 180 // The event on which the button should notify its listener. |
| 183 NotifyAction notify_action_; | 181 NotifyAction notify_action_; |
| 184 | 182 |
| 185 // True when a button click should trigger an animation action on | 183 // True when a button click should trigger an animation action on |
| 186 // ink_drop_delegate(). | 184 // ink_drop_delegate(). |
| 187 // TODO(bruthig): Use an InkDropAction enum and drop the flag. | |
| 188 bool has_ink_drop_action_on_click_; | 185 bool has_ink_drop_action_on_click_; |
| 189 | 186 |
| 190 // The animation action to trigger on ink_drop_delegate() when the button | |
| 191 // is clicked. | |
| 192 InkDropState ink_drop_action_on_click_; | |
| 193 | |
| 194 // When true, the ink drop ripple and hover will be hidden prior to showing | 187 // When true, the ink drop ripple and hover will be hidden prior to showing |
| 195 // the context menu. | 188 // the context menu. |
| 196 bool hide_ink_drop_when_showing_context_menu_; | 189 bool hide_ink_drop_when_showing_context_menu_; |
| 197 | 190 |
| 198 // The color of the ripple and hover. | 191 // The color of the ripple and hover. |
| 199 SkColor ink_drop_base_color_; | 192 SkColor ink_drop_base_color_; |
| 200 | 193 |
| 201 DISALLOW_COPY_AND_ASSIGN(CustomButton); | 194 DISALLOW_COPY_AND_ASSIGN(CustomButton); |
| 202 }; | 195 }; |
| 203 | 196 |
| 204 } // namespace views | 197 } // namespace views |
| 205 | 198 |
| 206 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 199 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |