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

Unified Diff: ui/views/controls/button/label_button_border.cc

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/label_button_border.h ('k') | ui/views/controls/button/radio_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_border.cc
diff --git a/ui/views/controls/button/label_button_border.cc b/ui/views/controls/button/label_button_border.cc
index 133105c7c27d104d5a5c61fc5f08bd436515b8e8..ef827667f9e119114afaac3ba7f2c2eae4ba1ef3 100644
--- a/ui/views/controls/button/label_button_border.cc
+++ b/ui/views/controls/button/label_button_border.cc
@@ -31,7 +31,7 @@ const int kTextHoveredImages[] = IMAGE_GRID(IDR_TEXTBUTTON_HOVER);
const int kTextPressedImages[] = IMAGE_GRID(IDR_TEXTBUTTON_PRESSED);
Button::ButtonState GetButtonState(ui::NativeTheme::State state) {
- switch(state) {
+ switch (state) {
case ui::NativeTheme::kDisabled: return Button::STATE_DISABLED;
case ui::NativeTheme::kHovered: return Button::STATE_HOVERED;
case ui::NativeTheme::kNormal: return Button::STATE_NORMAL;
@@ -67,6 +67,7 @@ void PaintHelper(LabelButtonBorder* border,
LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style)
: style_(style) {
if (style == Button::STYLE_BUTTON) {
+ set_insets(gfx::Insets(9, 13, 9, 13));
SetPainter(false, Button::STATE_NORMAL,
Painter::CreateImageGridPainter(kNormalImages));
SetPainter(false, Button::STATE_HOVERED,
@@ -84,17 +85,19 @@ LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style)
SetPainter(true, Button::STATE_DISABLED,
Painter::CreateImageGridPainter(kDisabledImages));
} else if (style == Button::STYLE_TEXTBUTTON) {
+ set_insets(gfx::Insets(5, 6, 5, 6));
SetPainter(false, Button::STATE_HOVERED,
Painter::CreateImageGridPainter(kTextHoveredImages));
SetPainter(false, Button::STATE_PRESSED,
Painter::CreateImageGridPainter(kTextPressedImages));
+ } else if (style == Button::STYLE_NATIVE_TEXTBUTTON) {
+ set_insets(gfx::Insets(5, 12, 5, 12));
}
}
LabelButtonBorder::~LabelButtonBorder() {}
void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) {
- DCHECK(!strcmp(view.GetClassName(), LabelButton::kViewClassName));
const NativeThemeDelegate* native_theme_delegate =
static_cast<const LabelButton*>(&view);
ui::NativeTheme::Part part = native_theme_delegate->GetThemePart();
@@ -127,15 +130,7 @@ void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) {
}
gfx::Insets LabelButtonBorder::GetInsets() const {
- // Return the style-specific insets between button contents and edges.
- if (style() == Button::STYLE_BUTTON)
- return gfx::Insets(9, 13, 9, 13);
- if (style() == Button::STYLE_TEXTBUTTON)
- return gfx::Insets(5, 6, 5, 6);
- if (style() == Button::STYLE_NATIVE_TEXTBUTTON)
- return gfx::Insets(5, 12, 5, 12);
- NOTREACHED();
- return gfx::Insets();
+ return insets_;
}
Painter* LabelButtonBorder::GetPainter(bool focused,
« no previous file with comments | « ui/views/controls/button/label_button_border.h ('k') | ui/views/controls/button/radio_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698