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/button/text_button.h" | 5 #include "views/controls/button/text_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/throb_animation.h" | 9 #include "app/throb_animation.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 void TextButton::UpdateColor() { | 384 void TextButton::UpdateColor() { |
385 color_ = IsEnabled() ? color_enabled_ : color_disabled_; | 385 color_ = IsEnabled() ? color_enabled_ : color_disabled_; |
386 } | 386 } |
387 | 387 |
388 void TextButton::UpdateTextSize() { | 388 void TextButton::UpdateTextSize() { |
389 int width = 0, height = 0; | 389 int width = 0, height = 0; |
390 gfx::CanvasSkia::SizeStringInt( | 390 gfx::CanvasSkia::SizeStringInt( |
391 text_, font_, &width, &height, | 391 text_, font_, &width, &height, |
392 gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); | 392 gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); |
393 text_size_.SetSize(width, font_.height()); | 393 text_size_.SetSize(width, font_.GetHeight()); |
394 max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), | 394 max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), |
395 std::max(max_text_size_.height(), | 395 std::max(max_text_size_.height(), |
396 text_size_.height())); | 396 text_size_.height())); |
397 PreferredSizeChanged(); | 397 PreferredSizeChanged(); |
398 } | 398 } |
399 | 399 |
400 //////////////////////////////////////////////////////////////////////////////// | 400 //////////////////////////////////////////////////////////////////////////////// |
401 // TextButton, View overrides: | 401 // TextButton, View overrides: |
402 | 402 |
403 gfx::Size TextButton::GetPreferredSize() { | 403 gfx::Size TextButton::GetPreferredSize() { |
(...skipping 29 matching lines...) Expand all Loading... |
433 | 433 |
434 std::string TextButton::GetClassName() const { | 434 std::string TextButton::GetClassName() const { |
435 return kViewClassName; | 435 return kViewClassName; |
436 } | 436 } |
437 | 437 |
438 void TextButton::Paint(gfx::Canvas* canvas) { | 438 void TextButton::Paint(gfx::Canvas* canvas) { |
439 Paint(canvas, false); | 439 Paint(canvas, false); |
440 } | 440 } |
441 | 441 |
442 } // namespace views | 442 } // namespace views |
OLD | NEW |