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

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

Issue 312233003: Add fade eliding for Views Labels; related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refine alignment check; minor additional cleanup. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/label.h » ('j') | 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/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 cached_normal_font_list_ = font_list; 116 cached_normal_font_list_ = font_list;
117 cached_bold_font_list_ = font_list.DeriveWithStyle( 117 cached_bold_font_list_ = font_list.DeriveWithStyle(
118 font_list.GetFontStyle() | gfx::Font::BOLD); 118 font_list.GetFontStyle() | gfx::Font::BOLD);
119 119
120 // STYLE_BUTTON uses bold text to indicate default buttons. 120 // STYLE_BUTTON uses bold text to indicate default buttons.
121 label_->SetFontList( 121 label_->SetFontList(
122 style_ == STYLE_BUTTON && is_default_ ? 122 style_ == STYLE_BUTTON && is_default_ ?
123 cached_bold_font_list_ : cached_normal_font_list_); 123 cached_bold_font_list_ : cached_normal_font_list_);
124 } 124 }
125 125
126 void LabelButton::SetElideBehavior(Label::ElideBehavior elide_behavior) { 126 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) {
127 label_->SetElideBehavior(elide_behavior); 127 label_->SetElideBehavior(elide_behavior);
128 } 128 }
129 129
130 gfx::HorizontalAlignment LabelButton::GetHorizontalAlignment() const { 130 gfx::HorizontalAlignment LabelButton::GetHorizontalAlignment() const {
131 return label_->horizontal_alignment(); 131 return label_->horizontal_alignment();
132 } 132 }
133 133
134 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { 134 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) {
135 label_->SetHorizontalAlignment(alignment); 135 label_->SetHorizontalAlignment(alignment);
136 InvalidateLayout(); 136 InvalidateLayout();
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 return ui::NativeTheme::kNormal; 429 return ui::NativeTheme::kNormal;
430 } 430 }
431 431
432 ui::NativeTheme::State LabelButton::GetForegroundThemeState( 432 ui::NativeTheme::State LabelButton::GetForegroundThemeState(
433 ui::NativeTheme::ExtraParams* params) const { 433 ui::NativeTheme::ExtraParams* params) const {
434 GetExtraParams(params); 434 GetExtraParams(params);
435 return ui::NativeTheme::kHovered; 435 return ui::NativeTheme::kHovered;
436 } 436 }
437 437
438 } // namespace views 438 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698