| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (style_ == STYLE_BUTTON) { | 133 if (style_ == STYLE_BUTTON) { |
| 134 int style = label_->font().GetStyle(); | 134 int style = label_->font().GetStyle(); |
| 135 style = is_default ? style | gfx::Font::BOLD : style & ~gfx::Font::BOLD; | 135 style = is_default ? style | gfx::Font::BOLD : style & ~gfx::Font::BOLD; |
| 136 label_->SetFont(label_->font().DeriveFont(0, style)); | 136 label_->SetFont(label_->font().DeriveFont(0, style)); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 void LabelButton::SetStyle(ButtonStyle style) { | 140 void LabelButton::SetStyle(ButtonStyle style) { |
| 141 // Use the new button style instead of the native button style. | 141 // Use the new button style instead of the native button style. |
| 142 // TODO(msw): Officialy deprecate and remove STYLE_NATIVE_TEXTBUTTON. | 142 // TODO(msw): Officialy deprecate and remove STYLE_NATIVE_TEXTBUTTON. |
| 143 if (DialogDelegate::UseNewStyle() && style == STYLE_NATIVE_TEXTBUTTON) | 143 if (style == STYLE_NATIVE_TEXTBUTTON) |
| 144 style = STYLE_BUTTON; | 144 style = STYLE_BUTTON; |
| 145 | 145 |
| 146 style_ = style; | 146 style_ = style; |
| 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 set_focus_border(style == STYLE_BUTTON ? | 149 set_focus_border(style == STYLE_BUTTON ? |
| 150 NULL : FocusBorder::CreateDashedFocusBorder(3, 3, 3, 3)); | 150 NULL : FocusBorder::CreateDashedFocusBorder(3, 3, 3, 3)); |
| 151 if (style == STYLE_BUTTON || style == STYLE_NATIVE_TEXTBUTTON) { | 151 if (style == STYLE_BUTTON || style == STYLE_NATIVE_TEXTBUTTON) { |
| 152 label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 152 label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 153 set_focusable(true); | 153 set_focusable(true); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return ui::NativeTheme::kNormal; | 366 return ui::NativeTheme::kNormal; |
| 367 } | 367 } |
| 368 | 368 |
| 369 ui::NativeTheme::State LabelButton::GetForegroundThemeState( | 369 ui::NativeTheme::State LabelButton::GetForegroundThemeState( |
| 370 ui::NativeTheme::ExtraParams* params) const { | 370 ui::NativeTheme::ExtraParams* params) const { |
| 371 GetExtraParams(params); | 371 GetExtraParams(params); |
| 372 return ui::NativeTheme::kHovered; | 372 return ui::NativeTheme::kHovered; |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace views | 375 } // namespace views |
| OLD | NEW |