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/label.h" | 5 #include "ui/views/controls/label.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <vector> | 10 #include <vector> |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 render_text_->SetElideBehavior(gfx::NO_ELIDE); | 397 render_text_->SetElideBehavior(gfx::NO_ELIDE); |
398 render_text_->SetFontList(font_list); | 398 render_text_->SetFontList(font_list); |
399 render_text_->SetCursorEnabled(false); | 399 render_text_->SetCursorEnabled(false); |
400 render_text_->SetWordWrapBehavior(gfx::TRUNCATE_LONG_WORDS); | 400 render_text_->SetWordWrapBehavior(gfx::TRUNCATE_LONG_WORDS); |
401 | 401 |
402 elide_behavior_ = gfx::ELIDE_TAIL; | 402 elide_behavior_ = gfx::ELIDE_TAIL; |
403 enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; | 403 enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; |
404 subpixel_rendering_enabled_ = true; | 404 subpixel_rendering_enabled_ = true; |
405 auto_color_readability_ = true; | 405 auto_color_readability_ = true; |
406 multi_line_ = false; | 406 multi_line_ = false; |
407 UpdateColorsFromTheme(ui::NativeTheme::instance()); | 407 UpdateColorsFromTheme(GetNativeTheme()); |
408 handles_tooltips_ = true; | 408 handles_tooltips_ = true; |
409 collapse_when_hidden_ = false; | 409 collapse_when_hidden_ = false; |
410 max_width_ = 0; | 410 max_width_ = 0; |
411 is_first_paint_text_ = true; | 411 is_first_paint_text_ = true; |
412 SetText(text); | 412 SetText(text); |
413 } | 413 } |
414 | 414 |
415 void Label::ResetLayout() { | 415 void Label::ResetLayout() { |
416 InvalidateLayout(); | 416 InvalidateLayout(); |
417 PreferredSizeChanged(); | 417 PreferredSizeChanged(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 574 } |
575 | 575 |
576 bool Label::ShouldShowDefaultTooltip() const { | 576 bool Label::ShouldShowDefaultTooltip() const { |
577 const gfx::Size text_size = GetTextSize(); | 577 const gfx::Size text_size = GetTextSize(); |
578 const gfx::Size size = GetContentsBounds().size(); | 578 const gfx::Size size = GetContentsBounds().size(); |
579 return !obscured() && (text_size.width() > size.width() || | 579 return !obscured() && (text_size.width() > size.width() || |
580 (multi_line() && text_size.height() > size.height())); | 580 (multi_line() && text_size.height() > size.height())); |
581 } | 581 } |
582 | 582 |
583 } // namespace views | 583 } // namespace views |
OLD | NEW |