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

Unified 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: rm dcheck 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/checkbox.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/label_button.h
diff --git a/ui/views/controls/button/label_button.h b/ui/views/controls/button/label_button.h
index b96c7854de60267627dded24aee36ae42f83620f..0f501914dc3aa340258b057f5a695fe3526a7221 100644
--- a/ui/views/controls/button/label_button.h
+++ b/ui/views/controls/button/label_button.h
@@ -27,7 +27,7 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
// Get or set the image shown for the specified button state.
// GetImage returns the image for STATE_NORMAL if the state's image is empty.
- const gfx::ImageSkia& GetImage(ButtonState for_state);
+ virtual const gfx::ImageSkia& GetImage(ButtonState for_state);
void SetImage(ButtonState for_state, const gfx::ImageSkia& image);
// Get or set the text shown on the button.
@@ -45,7 +45,7 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
const gfx::Font& GetFont() const;
void SetFont(const gfx::Font& font);
- // Get or set the horizontal alignment used for the button.
+ // Get or set the horizontal alignment used for the button; reversed in RTL.
// The optional image will lead the text, unless the button is right-aligned.
gfx::HorizontalAlignment GetHorizontalAlignment() const;
void SetHorizontalAlignment(gfx::HorizontalAlignment alignment);
@@ -64,8 +64,18 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
// Overridden from View:
virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
+ protected:
+ Label* label() const { return label_; }
+
+ // Fill |params| with information about the button.
+ virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
+
+ // Updates the image view to contain the appropriate button state image.
+ void UpdateImage();
+
private:
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init);
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label);
@@ -80,7 +90,6 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
virtual void StateChanged() OVERRIDE;
// Overridden from View:
- virtual void Layout() OVERRIDE;
virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
@@ -95,9 +104,6 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
virtual ui::NativeTheme::State GetForegroundThemeState(
ui::NativeTheme::ExtraParams* params) const OVERRIDE;
- // Fill |params| with information about the button.
- virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
-
// The image and label shown in the button.
ImageView* image_;
Label* label_;
« no previous file with comments | « ui/views/controls/button/checkbox.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698