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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void set_max_size(const gfx::Size& max_size) { max_size_ = max_size; } | 53 void set_max_size(const gfx::Size& max_size) { max_size_ = max_size; } |
54 | 54 |
55 // Get or set the option to handle the return key; false by default. | 55 // Get or set the option to handle the return key; false by default. |
56 bool default_button() const { return default_button_; } | 56 bool default_button() const { return default_button_; } |
57 void SetDefaultButton(bool default_button); | 57 void SetDefaultButton(bool default_button); |
58 | 58 |
59 // Get or set the option to use a native button appearance; false by default. | 59 // Get or set the option to use a native button appearance; false by default. |
60 bool native_theme() const { return native_theme_; } | 60 bool native_theme() const { return native_theme_; } |
61 void SetNativeTheme(bool native_theme); | 61 void SetNativeTheme(bool native_theme); |
62 | 62 |
| 63 // Overridden from View: |
| 64 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 65 |
63 private: | 66 private: |
64 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); | 67 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); |
65 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); | 68 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); |
66 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); | 69 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); |
67 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); | 70 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); |
68 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font); | 71 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font); |
69 | 72 |
70 // Resets colors from the NativeTheme, explicitly set colors are unchanged. | 73 // Resets colors from the NativeTheme, explicitly set colors are unchanged. |
71 void ResetColorsFromNativeTheme(); | 74 void ResetColorsFromNativeTheme(); |
72 | 75 |
73 // Overridden from CustomButton: | 76 // Overridden from CustomButton: |
74 virtual void StateChanged() OVERRIDE; | 77 virtual void StateChanged() OVERRIDE; |
75 | 78 |
76 // Overridden from View: | 79 // Overridden from View: |
77 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
78 virtual void Layout() OVERRIDE; | 80 virtual void Layout() OVERRIDE; |
79 virtual std::string GetClassName() const OVERRIDE; | 81 virtual std::string GetClassName() const OVERRIDE; |
80 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 82 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
81 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 83 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
82 | 84 |
83 // Overridden from NativeThemeDelegate: | 85 // Overridden from NativeThemeDelegate: |
84 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; | 86 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; |
85 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | 87 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; |
86 virtual ui::NativeTheme::State GetThemeState( | 88 virtual ui::NativeTheme::State GetThemeState( |
87 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 89 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
(...skipping 27 matching lines...) Expand all Loading... |
115 | 117 |
116 // Flag indicating native theme styling (or Views styling) of the button. | 118 // Flag indicating native theme styling (or Views styling) of the button. |
117 bool native_theme_; | 119 bool native_theme_; |
118 | 120 |
119 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 121 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
120 }; | 122 }; |
121 | 123 |
122 } // namespace views | 124 } // namespace views |
123 | 125 |
124 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 126 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
OLD | NEW |