| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| 11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class ThrobAnimation; | 14 class ThrobAnimation; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 class CustomButtonStateChangedDelegate; | 19 class CustomButtonStateChangedDelegate; |
| 20 | 20 |
| 21 // A button with custom rendering. The common base class of ImageButton and | 21 // A button with custom rendering. The common base class of ImageButton and |
| 22 // TextButton. | 22 // TextButton. |
| 23 // Note that this type of button is not focusable by default and will not be | 23 // Note that this type of button is not focusable by default and will not be |
| 24 // part of the focus chain. Call set_focusable(true) to make it part of the | 24 // part of the focus chain. Call set_focusable(true) to make it part of the |
| 25 // focus chain. | 25 // focus chain. |
| 26 class VIEWS_EXPORT CustomButton : public Button, | 26 class VIEWS_EXPORT CustomButton : public Button, |
| 27 public gfx::AnimationDelegate { | 27 public gfx::AnimationDelegate { |
| 28 public: | 28 public: |
| 29 // How long the hover animation takes if uninterrupted. |
| 30 static const int kHoverFadeDurationMs; |
| 31 |
| 29 // The menu button's class name. | 32 // The menu button's class name. |
| 30 static const char kViewClassName[]; | 33 static const char kViewClassName[]; |
| 31 | 34 |
| 32 virtual ~CustomButton(); | 35 virtual ~CustomButton(); |
| 33 | 36 |
| 34 // Get/sets the current display state of the button. | 37 // Get/sets the current display state of the button. |
| 35 ButtonState state() const { return state_; } | 38 ButtonState state() const { return state_; } |
| 36 void SetState(ButtonState state); | 39 void SetState(ButtonState state); |
| 37 | 40 |
| 38 // Starts throbbing. See HoverAnimation for a description of cycles_til_stop. | 41 // Starts throbbing. See HoverAnimation for a description of cycles_til_stop. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 protected: | 152 protected: |
| 150 CustomButtonStateChangedDelegate() {} | 153 CustomButtonStateChangedDelegate() {} |
| 151 | 154 |
| 152 private: | 155 private: |
| 153 DISALLOW_COPY_AND_ASSIGN(CustomButtonStateChangedDelegate); | 156 DISALLOW_COPY_AND_ASSIGN(CustomButtonStateChangedDelegate); |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 } // namespace views | 159 } // namespace views |
| 157 | 160 |
| 158 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ | 161 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ |
| OLD | NEW |