| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/label.h" | 5 #include "views/controls/label.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (is_multi_line_) { | 264 if (is_multi_line_) { |
| 265 text_size_valid_ = false; | 265 text_size_valid_ = false; |
| 266 PreferredSizeChanged(); | 266 PreferredSizeChanged(); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 void Label::PaintText(gfx::Canvas* canvas, | 270 void Label::PaintText(gfx::Canvas* canvas, |
| 271 const std::wstring& text, | 271 const std::wstring& text, |
| 272 const gfx::Rect& text_bounds, | 272 const gfx::Rect& text_bounds, |
| 273 int flags) { | 273 int flags) { |
| 274 canvas->DrawStringInt(WideToUTF16Hack(text), font_, color_, | 274 canvas->DrawStringInt(text, font_, color_, |
| 275 text_bounds.x(), text_bounds.y(), | 275 text_bounds.x(), text_bounds.y(), |
| 276 text_bounds.width(), text_bounds.height(), flags); | 276 text_bounds.width(), text_bounds.height(), flags); |
| 277 | 277 |
| 278 if (HasFocus() || paint_as_focused_) { | 278 if (HasFocus() || paint_as_focused_) { |
| 279 gfx::Rect focus_bounds = text_bounds; | 279 gfx::Rect focus_bounds = text_bounds; |
| 280 focus_bounds.Inset(-kFocusBorderPadding, -kFocusBorderPadding); | 280 focus_bounds.Inset(-kFocusBorderPadding, -kFocusBorderPadding); |
| 281 canvas->DrawFocusRect(focus_bounds.x(), focus_bounds.y(), | 281 canvas->DrawFocusRect(focus_bounds.x(), focus_bounds.y(), |
| 282 focus_bounds.width(), focus_bounds.height()); | 282 focus_bounds.width(), focus_bounds.height()); |
| 283 } | 283 } |
| 284 } | 284 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 font_, GetAvailableRect().width(), true)); | 446 font_, GetAvailableRect().width(), true)); |
| 447 } else { | 447 } else { |
| 448 *paint_text = UTF16ToWideHack(text_); | 448 *paint_text = UTF16ToWideHack(text_); |
| 449 } | 449 } |
| 450 | 450 |
| 451 *text_bounds = GetTextBounds(); | 451 *text_bounds = GetTextBounds(); |
| 452 *flags = ComputeMultiLineFlags(); | 452 *flags = ComputeMultiLineFlags(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace views | 455 } // namespace views |
| OLD | NEW |