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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 requested_disabled_color_ = ui::NativeTheme::instance()->GetSystemColor( | 353 requested_disabled_color_ = ui::NativeTheme::instance()->GetSystemColor( |
354 ui::NativeTheme::kColorId_LabelDisabledColor); | 354 ui::NativeTheme::kColorId_LabelDisabledColor); |
355 background_color_ = ui::NativeTheme::instance()->GetSystemColor( | 355 background_color_ = ui::NativeTheme::instance()->GetSystemColor( |
356 ui::NativeTheme::kColorId_LabelBackgroundColor); | 356 ui::NativeTheme::kColorId_LabelBackgroundColor); |
357 auto_color_readability_ = true; | 357 auto_color_readability_ = true; |
358 RecalculateColors(); | 358 RecalculateColors(); |
359 horiz_alignment_ = ALIGN_CENTER; | 359 horiz_alignment_ = ALIGN_CENTER; |
360 is_multi_line_ = false; | 360 is_multi_line_ = false; |
361 allow_character_break_ = false; | 361 allow_character_break_ = false; |
362 elide_in_middle_ = false; | 362 elide_in_middle_ = false; |
| 363 elide_at_end_ = false; |
363 is_email_ = false; | 364 is_email_ = false; |
364 collapse_when_hidden_ = false; | 365 collapse_when_hidden_ = false; |
365 directionality_mode_ = USE_UI_DIRECTIONALITY; | 366 directionality_mode_ = USE_UI_DIRECTIONALITY; |
366 paint_as_focused_ = false; | 367 paint_as_focused_ = false; |
367 has_focus_border_ = false; | 368 has_focus_border_ = false; |
368 enabled_shadow_color_ = 0; | 369 enabled_shadow_color_ = 0; |
369 disabled_shadow_color_ = 0; | 370 disabled_shadow_color_ = 0; |
370 shadow_offset_.SetPoint(1, 1); | 371 shadow_offset_.SetPoint(1, 1); |
371 has_shadow_ = false; | 372 has_shadow_ = false; |
372 | 373 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 void Label::CalculateDrawStringParams(string16* paint_text, | 482 void Label::CalculateDrawStringParams(string16* paint_text, |
482 gfx::Rect* text_bounds, | 483 gfx::Rect* text_bounds, |
483 int* flags) const { | 484 int* flags) const { |
484 DCHECK(paint_text && text_bounds && flags); | 485 DCHECK(paint_text && text_bounds && flags); |
485 | 486 |
486 if (is_email_) { | 487 if (is_email_) { |
487 *paint_text = ui::ElideEmail(text_, font_, GetAvailableRect().width()); | 488 *paint_text = ui::ElideEmail(text_, font_, GetAvailableRect().width()); |
488 } else if (elide_in_middle_) { | 489 } else if (elide_in_middle_) { |
489 *paint_text = ui::ElideText(text_, font_, GetAvailableRect().width(), | 490 *paint_text = ui::ElideText(text_, font_, GetAvailableRect().width(), |
490 ui::ELIDE_IN_MIDDLE); | 491 ui::ELIDE_IN_MIDDLE); |
| 492 } else if (elide_at_end_) { |
| 493 *paint_text = ui::ElideText(text_, font_, GetAvailableRect().width(), |
| 494 ui::ELIDE_AT_END); |
491 } else { | 495 } else { |
492 *paint_text = text_; | 496 *paint_text = text_; |
493 } | 497 } |
494 | 498 |
495 *text_bounds = GetTextBounds(); | 499 *text_bounds = GetTextBounds(); |
496 *flags = ComputeDrawStringFlags(); | 500 *flags = ComputeDrawStringFlags(); |
497 } | 501 } |
498 | 502 |
499 } // namespace views | 503 } // namespace views |
OLD | NEW |