Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: ui/views/controls/button/label_button.h

Issue 15061006: views: Switch Checkbox over to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: set the image for STATE_TOGGLED Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void SetIsDefault(bool is_default); 59 void SetIsDefault(bool is_default);
60 60
61 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. 61 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|.
62 ButtonStyle style() const { return style_; } 62 ButtonStyle style() const { return style_; }
63 void SetStyle(ButtonStyle style); 63 void SetStyle(ButtonStyle style);
64 64
65 // Overridden from View: 65 // Overridden from View:
66 virtual gfx::Size GetPreferredSize() OVERRIDE; 66 virtual gfx::Size GetPreferredSize() OVERRIDE;
67 virtual const char* GetClassName() const OVERRIDE; 67 virtual const char* GetClassName() const OVERRIDE;
68 68
69 protected:
70 // Fill |params| with information about the button.
71 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
72
69 private: 73 private:
70 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); 74 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init);
71 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); 75 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label);
72 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); 76 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image);
73 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); 77 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage);
74 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font); 78 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font);
75 79
76 // Resets colors from the NativeTheme, explicitly set colors are unchanged. 80 // Resets colors from the NativeTheme, explicitly set colors are unchanged.
77 void ResetColorsFromNativeTheme(); 81 void ResetColorsFromNativeTheme();
78 82
79 // Overridden from CustomButton: 83 // Overridden from CustomButton:
80 virtual void StateChanged() OVERRIDE; 84 virtual void StateChanged() OVERRIDE;
81 85
82 // Overridden from View: 86 // Overridden from View:
83 virtual void Layout() OVERRIDE; 87 virtual void Layout() OVERRIDE;
84 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; 88 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
85 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; 89 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
86 90
87 // Overridden from NativeThemeDelegate: 91 // Overridden from NativeThemeDelegate:
88 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; 92 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE;
89 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; 93 virtual gfx::Rect GetThemePaintRect() const OVERRIDE;
90 virtual ui::NativeTheme::State GetThemeState( 94 virtual ui::NativeTheme::State GetThemeState(
91 ui::NativeTheme::ExtraParams* params) const OVERRIDE; 95 ui::NativeTheme::ExtraParams* params) const OVERRIDE;
92 virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; 96 virtual const ui::Animation* GetThemeAnimation() const OVERRIDE;
93 virtual ui::NativeTheme::State GetBackgroundThemeState( 97 virtual ui::NativeTheme::State GetBackgroundThemeState(
94 ui::NativeTheme::ExtraParams* params) const OVERRIDE; 98 ui::NativeTheme::ExtraParams* params) const OVERRIDE;
95 virtual ui::NativeTheme::State GetForegroundThemeState( 99 virtual ui::NativeTheme::State GetForegroundThemeState(
96 ui::NativeTheme::ExtraParams* params) const OVERRIDE; 100 ui::NativeTheme::ExtraParams* params) const OVERRIDE;
97 101
98 // Fill |params| with information about the button.
99 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
100 102
101 // The image and label shown in the button. 103 // The image and label shown in the button.
102 ImageView* image_; 104 ImageView* image_;
103 Label* label_; 105 Label* label_;
104 106
105 // The images and colors for each button state. 107 // The images and colors for each button state.
106 gfx::ImageSkia button_state_images_[STATE_COUNT]; 108 gfx::ImageSkia button_state_images_[STATE_COUNT];
107 SkColor button_state_colors_[STATE_COUNT]; 109 SkColor button_state_colors_[STATE_COUNT];
108 110
109 // Used to track whether SetTextColor() has been invoked. 111 // Used to track whether SetTextColor() has been invoked.
(...skipping 11 matching lines...) Expand all
121 123
122 // The button's overall style. 124 // The button's overall style.
123 ButtonStyle style_; 125 ButtonStyle style_;
124 126
125 DISALLOW_COPY_AND_ASSIGN(LabelButton); 127 DISALLOW_COPY_AND_ASSIGN(LabelButton);
126 }; 128 };
127 129
128 } // namespace views 130 } // namespace views
129 131
130 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 132 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698