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 "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. | 64 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. |
65 ButtonStyle style() const { return style_; } | 65 ButtonStyle style() const { return style_; } |
66 void SetStyle(ButtonStyle style); | 66 void SetStyle(ButtonStyle style); |
67 | 67 |
68 // Overridden from View: | 68 // Overridden from View: |
69 virtual gfx::Size GetPreferredSize() OVERRIDE; | 69 virtual gfx::Size GetPreferredSize() OVERRIDE; |
70 virtual void Layout() OVERRIDE; | 70 virtual void Layout() OVERRIDE; |
71 virtual const char* GetClassName() const OVERRIDE; | 71 virtual const char* GetClassName() const OVERRIDE; |
72 | 72 |
73 protected: | 73 protected: |
74 ImageView* image() const { return image_; } | |
74 Label* label() const { return label_; } | 75 Label* label() const { return label_; } |
75 | 76 |
76 // Fill |params| with information about the button. | 77 // Fill |params| with information about the button. |
77 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; | 78 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; |
78 | 79 |
79 // Resets colors from the NativeTheme, explicitly set colors are unchanged. | 80 // Resets colors from the NativeTheme, explicitly set colors are unchanged. |
80 virtual void ResetColorsFromNativeTheme(); | 81 virtual void ResetColorsFromNativeTheme(); |
81 | 82 |
82 // Updates the image view to contain the appropriate button state image. | 83 // Updates the image view to contain the appropriate button state image. |
83 void UpdateImage(); | 84 void UpdateImage(); |
84 | 85 |
86 // Overridden from NativeThemeDelegate: | |
Peter Kasting
2013/11/23 00:23:55
Nit: Just "NativeThemeDelegate:" (and fix other ca
Greg Billock
2013/11/25 17:16:30
Done.
| |
87 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | |
88 | |
85 private: | 89 private: |
86 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); | 90 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); |
87 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); | 91 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); |
88 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); | 92 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); |
89 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); | 93 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); |
90 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font); | 94 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font); |
91 | 95 |
92 // Overridden from CustomButton: | 96 // Overridden from CustomButton: |
93 virtual void StateChanged() OVERRIDE; | 97 virtual void StateChanged() OVERRIDE; |
94 | 98 |
95 // Overridden from View: | 99 // Overridden from View: |
96 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 100 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
97 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 101 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
98 | 102 |
99 // Overridden from NativeThemeDelegate: | 103 // Overridden from NativeThemeDelegate: |
100 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; | 104 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; |
101 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | |
102 virtual ui::NativeTheme::State GetThemeState( | 105 virtual ui::NativeTheme::State GetThemeState( |
103 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 106 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
104 virtual const gfx::Animation* GetThemeAnimation() const OVERRIDE; | 107 virtual const gfx::Animation* GetThemeAnimation() const OVERRIDE; |
105 virtual ui::NativeTheme::State GetBackgroundThemeState( | 108 virtual ui::NativeTheme::State GetBackgroundThemeState( |
106 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 109 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
107 virtual ui::NativeTheme::State GetForegroundThemeState( | 110 virtual ui::NativeTheme::State GetForegroundThemeState( |
108 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 111 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
109 | 112 |
110 // The image and label shown in the button. | 113 // The image and label shown in the button. |
111 ImageView* image_; | 114 ImageView* image_; |
(...skipping 18 matching lines...) Expand all Loading... | |
130 | 133 |
131 // The button's overall style. | 134 // The button's overall style. |
132 ButtonStyle style_; | 135 ButtonStyle style_; |
133 | 136 |
134 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 137 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
135 }; | 138 }; |
136 | 139 |
137 } // namespace views | 140 } // namespace views |
138 | 141 |
139 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 142 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
OLD | NEW |