OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 state->role = ui::AccessibilityTypes::ROLE_STATICTEXT; | 261 state->role = ui::AccessibilityTypes::ROLE_STATICTEXT; |
262 state->state = ui::AccessibilityTypes::STATE_READONLY; | 262 state->state = ui::AccessibilityTypes::STATE_READONLY; |
263 state->name = text_; | 263 state->name = text_; |
264 } | 264 } |
265 | 265 |
266 void Label::PaintText(gfx::Canvas* canvas, | 266 void Label::PaintText(gfx::Canvas* canvas, |
267 const string16& text, | 267 const string16& text, |
268 const gfx::Rect& text_bounds, | 268 const gfx::Rect& text_bounds, |
269 int flags) { | 269 int flags) { |
270 canvas->DrawStringInt(text, font_, | 270 canvas->DrawStringInt(text, font_, |
271 IsEnabled() ? actual_enabled_color_ : actual_disabled_color_, | 271 enabled() ? actual_enabled_color_ : actual_disabled_color_, |
272 text_bounds.x(), text_bounds.y(), text_bounds.width(), | 272 text_bounds.x(), text_bounds.y(), text_bounds.width(), |
273 text_bounds.height(), flags); | 273 text_bounds.height(), flags); |
274 | 274 |
275 if (HasFocus() || paint_as_focused_) { | 275 if (HasFocus() || paint_as_focused_) { |
276 gfx::Rect focus_bounds = text_bounds; | 276 gfx::Rect focus_bounds = text_bounds; |
277 focus_bounds.Inset(-kFocusBorderPadding, -kFocusBorderPadding); | 277 focus_bounds.Inset(-kFocusBorderPadding, -kFocusBorderPadding); |
278 canvas->DrawFocusRect(focus_bounds); | 278 canvas->DrawFocusRect(focus_bounds); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // it is right aligned. Otherwise, its directionality is forced to be LTR. | 498 // it is right aligned. Otherwise, its directionality is forced to be LTR. |
499 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { | 499 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { |
500 if (horiz_alignment_ == ALIGN_RIGHT) | 500 if (horiz_alignment_ == ALIGN_RIGHT) |
501 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; | 501 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; |
502 else | 502 else |
503 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; | 503 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; |
504 } | 504 } |
505 } | 505 } |
506 | 506 |
507 } // namespace views | 507 } // namespace views |
OLD | NEW |