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 #include "ui/views/controls/button/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/animation/throb_animation.h" | 10 #include "ui/gfx/animation/throb_animation.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 set_border(new LabelButtonBorder(style)); | 147 set_border(new LabelButtonBorder(style)); |
148 // Inset the button focus rect from the actual border; roughly match Windows. | 148 // Inset the button focus rect from the actual border; roughly match Windows. |
149 if (style == STYLE_BUTTON) { | 149 if (style == STYLE_BUTTON) { |
150 SetFocusPainter(scoped_ptr<Painter>()); | 150 SetFocusPainter(scoped_ptr<Painter>()); |
151 } else { | 151 } else { |
152 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets( | 152 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets( |
153 gfx::Insets(3, 3, 3, 3))); | 153 gfx::Insets(3, 3, 3, 3))); |
154 } | 154 } |
155 if (style == STYLE_BUTTON || style == STYLE_NATIVE_TEXTBUTTON) { | 155 if (style == STYLE_BUTTON || style == STYLE_NATIVE_TEXTBUTTON) { |
156 label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 156 label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
157 set_focusable(true); | 157 SetFocusable(true); |
158 } | 158 } |
159 if (style == STYLE_BUTTON) | 159 if (style == STYLE_BUTTON) |
160 set_min_size(gfx::Size(70, 33)); | 160 set_min_size(gfx::Size(70, 33)); |
161 // Invalidate the layout to pickup the new insets from the border. | 161 // Invalidate the layout to pickup the new insets from the border. |
162 InvalidateLayout(); | 162 InvalidateLayout(); |
163 ResetColorsFromNativeTheme(); | 163 ResetColorsFromNativeTheme(); |
164 } | 164 } |
165 | 165 |
166 void LabelButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) { | 166 void LabelButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) { |
167 focus_painter_ = focus_painter.Pass(); | 167 focus_painter_ = focus_painter.Pass(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return ui::NativeTheme::kNormal; | 394 return ui::NativeTheme::kNormal; |
395 } | 395 } |
396 | 396 |
397 ui::NativeTheme::State LabelButton::GetForegroundThemeState( | 397 ui::NativeTheme::State LabelButton::GetForegroundThemeState( |
398 ui::NativeTheme::ExtraParams* params) const { | 398 ui::NativeTheme::ExtraParams* params) const { |
399 GetExtraParams(params); | 399 GetExtraParams(params); |
400 return ui::NativeTheme::kHovered; | 400 return ui::NativeTheme::kHovered; |
401 } | 401 } |
402 | 402 |
403 } // namespace views | 403 } // namespace views |
OLD | NEW |