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/animation/throb_animation.h" | 9 #include "ui/base/animation/throb_animation.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void LabelButton::SetIsDefault(bool is_default) { | 121 void LabelButton::SetIsDefault(bool is_default) { |
122 if (is_default == is_default_) | 122 if (is_default == is_default_) |
123 return; | 123 return; |
124 is_default_ = is_default; | 124 is_default_ = is_default; |
125 ui::Accelerator accel(ui::VKEY_RETURN, ui::EF_NONE); | 125 ui::Accelerator accel(ui::VKEY_RETURN, ui::EF_NONE); |
126 is_default_ ? AddAccelerator(accel) : RemoveAccelerator(accel); | 126 is_default_ ? AddAccelerator(accel) : RemoveAccelerator(accel); |
127 | 127 |
128 // STYLE_BUTTON uses bold text to indicate default buttons. | 128 // STYLE_BUTTON uses bold text to indicate default buttons. |
129 if (style_ == STYLE_BUTTON) { | 129 if (style_ == STYLE_BUTTON) { |
130 int style = label_->font().GetStyle(); | 130 int style = label_->font().GetStyle(); |
131 style = is_default ? style | gfx::Font::BOLD : style & !gfx::Font::BOLD; | 131 style = is_default ? style | gfx::Font::BOLD : style & ~gfx::Font::BOLD; |
132 label_->SetFont(label_->font().DeriveFont(0, style)); | 132 label_->SetFont(label_->font().DeriveFont(0, style)); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 void LabelButton::SetStyle(ButtonStyle style) { | 136 void LabelButton::SetStyle(ButtonStyle style) { |
137 // Use the new button style instead of the native button style. | 137 // Use the new button style instead of the native button style. |
138 // TODO(msw): Officialy deprecate and remove STYLE_NATIVE_TEXTBUTTON. | 138 // TODO(msw): Officialy deprecate and remove STYLE_NATIVE_TEXTBUTTON. |
139 if (DialogDelegate::UseNewStyle() && style == STYLE_NATIVE_TEXTBUTTON) | 139 if (DialogDelegate::UseNewStyle() && style == STYLE_NATIVE_TEXTBUTTON) |
140 style = STYLE_BUTTON; | 140 style = STYLE_BUTTON; |
141 | 141 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return ui::NativeTheme::kNormal; | 363 return ui::NativeTheme::kNormal; |
364 } | 364 } |
365 | 365 |
366 ui::NativeTheme::State LabelButton::GetForegroundThemeState( | 366 ui::NativeTheme::State LabelButton::GetForegroundThemeState( |
367 ui::NativeTheme::ExtraParams* params) const { | 367 ui::NativeTheme::ExtraParams* params) const { |
368 GetExtraParams(params); | 368 GetExtraParams(params); |
369 return ui::NativeTheme::kHovered; | 369 return ui::NativeTheme::kHovered; |
370 } | 370 } |
371 | 371 |
372 } // namespace views | 372 } // namespace views |
OLD | NEW |