Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: views/controls/button/text_button.cc

Issue 5158006: Convert SizeStringInt from taking a wstring to a string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gfx/platform_font_win.cc ('k') | views/controls/label.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/utf_string_conversions.h"
11 #include "gfx/canvas_skia.h" 12 #include "gfx/canvas_skia.h"
12 #include "views/controls/button/button.h" 13 #include "views/controls/button/button.h"
13 #include "views/event.h" 14 #include "views/event.h"
14 #include "grit/app_resources.h" 15 #include "grit/app_resources.h"
15 16
16 namespace views { 17 namespace views {
17 18
18 // Default space between the icon and text. 19 // Default space between the icon and text.
19 static const int kDefaultIconTextSpacing = 5; 20 static const int kDefaultIconTextSpacing = 5;
20 21
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 395 }
395 } 396 }
396 397
397 void TextButton::UpdateColor() { 398 void TextButton::UpdateColor() {
398 color_ = IsEnabled() ? color_enabled_ : color_disabled_; 399 color_ = IsEnabled() ? color_enabled_ : color_disabled_;
399 } 400 }
400 401
401 void TextButton::UpdateTextSize() { 402 void TextButton::UpdateTextSize() {
402 int width = 0, height = 0; 403 int width = 0, height = 0;
403 gfx::CanvasSkia::SizeStringInt( 404 gfx::CanvasSkia::SizeStringInt(
404 text_, font_, &width, &height, 405 WideToUTF16Hack(text_), font_, &width, &height,
405 gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); 406 gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_));
406 407
407 // Add 2 extra pixels to width and height when text halo is used. 408 // Add 2 extra pixels to width and height when text halo is used.
408 if (has_text_halo_) { 409 if (has_text_halo_) {
409 width += 2; 410 width += 2;
410 height += 2; 411 height += 2;
411 } 412 }
412 413
413 text_size_.SetSize(width, font_.GetHeight()); 414 text_size_.SetSize(width, font_.GetHeight());
414 max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), 415 max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 454
454 std::string TextButton::GetClassName() const { 455 std::string TextButton::GetClassName() const {
455 return kViewClassName; 456 return kViewClassName;
456 } 457 }
457 458
458 void TextButton::Paint(gfx::Canvas* canvas) { 459 void TextButton::Paint(gfx::Canvas* canvas) {
459 Paint(canvas, false); 460 Paint(canvas, false);
460 } 461 }
461 462
462 } // namespace views 463 } // namespace views
OLDNEW
« no previous file with comments | « gfx/platform_font_win.cc ('k') | views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698