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

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 22831006: In LabelButton::SetIsDefault: ~ is bitwise NOT, not !. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698