| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 cached_bold_font_list_ = font_list.DeriveWithWeight( | 185 cached_bold_font_list_ = font_list.DeriveWithWeight( |
| 186 GetValueBolderThan(font_list.GetFontWeight())); | 186 GetValueBolderThan(font_list.GetFontWeight())); |
| 187 if (is_default_) { | 187 if (is_default_) { |
| 188 label_->SetFontList(cached_bold_font_list_); | 188 label_->SetFontList(cached_bold_font_list_); |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 label_->SetFontList(cached_normal_font_list_); | 192 label_->SetFontList(cached_normal_font_list_); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void LabelButton::AdjustFontSize(int font_size_delta) { |
| 196 LabelButton::SetFontList(GetFontList().DeriveWithSizeDelta(font_size_delta)); |
| 197 } |
| 198 |
| 195 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) { | 199 void LabelButton::SetElideBehavior(gfx::ElideBehavior elide_behavior) { |
| 196 label_->SetElideBehavior(elide_behavior); | 200 label_->SetElideBehavior(elide_behavior); |
| 197 } | 201 } |
| 198 | 202 |
| 199 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { | 203 void LabelButton::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { |
| 200 DCHECK_NE(gfx::ALIGN_TO_HEAD, alignment); | 204 DCHECK_NE(gfx::ALIGN_TO_HEAD, alignment); |
| 201 horizontal_alignment_ = alignment; | 205 horizontal_alignment_ = alignment; |
| 202 InvalidateLayout(); | 206 InvalidateLayout(); |
| 203 } | 207 } |
| 204 | 208 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 void LabelButton::ResetLabelEnabledColor() { | 593 void LabelButton::ResetLabelEnabledColor() { |
| 590 const SkColor color = | 594 const SkColor color = |
| 591 explicitly_set_colors_[state()] | 595 explicitly_set_colors_[state()] |
| 592 ? button_state_colors_[state()] | 596 ? button_state_colors_[state()] |
| 593 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 597 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 594 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 598 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 595 label_->SetEnabledColor(color); | 599 label_->SetEnabledColor(color); |
| 596 } | 600 } |
| 597 | 601 |
| 598 } // namespace views | 602 } // namespace views |
| OLD | NEW |