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

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: 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 side-by-side diff with in-line comments
Download patch
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 9b7b13afb69827301f0a9148f75507d726546737..acfd84276752688e7fb90f7e4b70049cbb3de765 100644
--- a/ui/views/controls/button/label_button_border.cc
+++ b/ui/views/controls/button/label_button_border.cc
@@ -30,11 +30,12 @@ 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;
case ui::NativeTheme::kPressed: return Button::STATE_PRESSED;
+ case ui::NativeTheme::kToggled: return Button::STATE_TOGGLED;
case ui::NativeTheme::kMaxState: NOTREACHED() << "Unknown state: " << state;
}
return Button::STATE_NORMAL;
@@ -93,7 +94,7 @@ LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style)
LabelButtonBorder::~LabelButtonBorder() {}
void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) {
- DCHECK(!strcmp(view.GetClassName(), LabelButton::kViewClassName));
+ //DCHECK(!strcmp(view.GetClassName(), LabelButton::kViewClassName));
msw 2013/05/16 22:40:05 You can just remove this DCHECK.
tfarina 2013/05/18 00:54:08 Done.
const NativeThemeDelegate* native_theme_delegate =
static_cast<const LabelButton*>(&view);
ui::NativeTheme::Part part = native_theme_delegate->GetThemePart();
@@ -138,6 +139,10 @@ gfx::Insets LabelButtonBorder::GetInsets() const {
return gfx::Insets(5, 6, 5, 6);
if (style() == Button::STYLE_NATIVE_TEXTBUTTON)
return gfx::Insets(5, 12, 5, 12);
+ if (style() == Button::STYLE_CHECKBOX)
msw 2013/05/16 22:40:05 Would you mind making this function a switch inste
tfarina 2013/05/18 00:54:08 Done.
+ return gfx::Insets(5, 12, 5, 12);
+ if (style() == Button::STYLE_RADIO)
+ return gfx::Insets(5, 12, 5, 12);
NOTREACHED();
return gfx::Insets();
}

Powered by Google App Engine
This is Rietveld 408576698