| 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_LABEL_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 12 #include "ui/views/controls/button/custom_button.h" | 12 #include "ui/views/controls/button/custom_button.h" |
| 13 #include "ui/views/controls/image_view.h" | 13 #include "ui/views/controls/image_view.h" |
| 14 #include "ui/views/controls/label.h" | 14 #include "ui/views/controls/label.h" |
| 15 #include "ui/views/native_theme_delegate.h" | 15 #include "ui/views/native_theme_delegate.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 class LabelButtonBorder; |
| 19 class Painter; | 20 class Painter; |
| 20 | 21 |
| 21 // LabelButton is an alternative to TextButton, it's not focusable by default. | 22 // LabelButton is an alternative to TextButton, it's not focusable by default. |
| 22 class VIEWS_EXPORT LabelButton : public CustomButton, | 23 class VIEWS_EXPORT LabelButton : public CustomButton, |
| 23 public NativeThemeDelegate { | 24 public NativeThemeDelegate { |
| 24 public: | 25 public: |
| 25 // The length of the hover fade animation. | 26 // The length of the hover fade animation. |
| 26 static const int kHoverAnimationDurationMs; | 27 static const int kHoverAnimationDurationMs; |
| 27 | 28 |
| 28 static const char kViewClassName[]; | 29 static const char kViewClassName[]; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 89 |
| 89 // Fill |params| with information about the button. | 90 // Fill |params| with information about the button. |
| 90 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; | 91 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; |
| 91 | 92 |
| 92 // Resets colors from the NativeTheme, explicitly set colors are unchanged. | 93 // Resets colors from the NativeTheme, explicitly set colors are unchanged. |
| 93 virtual void ResetColorsFromNativeTheme(); | 94 virtual void ResetColorsFromNativeTheme(); |
| 94 | 95 |
| 95 // Updates the image view to contain the appropriate button state image. | 96 // Updates the image view to contain the appropriate button state image. |
| 96 void UpdateImage(); | 97 void UpdateImage(); |
| 97 | 98 |
| 99 // Updates our border with a specific LabelButtonBorder instance which has |
| 100 // different insets, etc. This may wrap the border in an object which will |
| 101 // draw a native style border. |
| 102 void UpdateThemedBorder(LabelButtonBorder* label_button_border); |
| 103 |
| 98 // NativeThemeDelegate: | 104 // NativeThemeDelegate: |
| 99 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | 105 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; |
| 100 | 106 |
| 101 private: | 107 private: |
| 102 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); | 108 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); |
| 103 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); | 109 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); |
| 104 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); | 110 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); |
| 105 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); | 111 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); |
| 106 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, FontList); | 112 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, FontList); |
| 107 | 113 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 ButtonStyle style_; | 153 ButtonStyle style_; |
| 148 | 154 |
| 149 scoped_ptr<Painter> focus_painter_; | 155 scoped_ptr<Painter> focus_painter_; |
| 150 | 156 |
| 151 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 157 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
| 152 }; | 158 }; |
| 153 | 159 |
| 154 } // namespace views | 160 } // namespace views |
| 155 | 161 |
| 156 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 162 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| OLD | NEW |