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

Side by Side Diff: chrome/views/window/dialog_client_view.cc

Issue 62064: UI font localization part 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months 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 | « chrome/views/window/dialog_client_view.h ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/views/window/dialog_client_view.h" 5 #include "chrome/views/window/dialog_client_view.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 private: 71 private:
72 Window* owner_; 72 Window* owner_;
73 const DialogDelegate::DialogButton type_; 73 const DialogDelegate::DialogButton type_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(DialogButton); 75 DISALLOW_COPY_AND_ASSIGN(DialogButton);
76 }; 76 };
77 77
78 } // namespace 78 } // namespace
79 79
80 // static 80 // static
81 ChromeFont DialogClientView::dialog_button_font_; 81 ChromeFont* DialogClientView::dialog_button_font_ = NULL;
82 static const int kDialogMinButtonWidth = 75; 82 static const int kDialogMinButtonWidth = 75;
83 static const int kDialogButtonLabelSpacing = 16; 83 static const int kDialogButtonLabelSpacing = 16;
84 static const int kDialogButtonContentSpacing = 5; 84 static const int kDialogButtonContentSpacing = 5;
85 85
86 // The group used by the buttons. This name is chosen voluntarily big not to 86 // The group used by the buttons. This name is chosen voluntarily big not to
87 // conflict with other groups that could be in the dialog content. 87 // conflict with other groups that could be in the dialog content.
88 static const int kButtonGroup = 6666; 88 static const int kButtonGroup = 6666;
89 89
90 /////////////////////////////////////////////////////////////////////////////// 90 ///////////////////////////////////////////////////////////////////////////////
91 // DialogClientView, public: 91 // DialogClientView, public:
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 gfx::NativeTheme::instance()->PaintStatusGripper( 346 gfx::NativeTheme::instance()->PaintStatusGripper(
347 dc, SP_PANE, 1, 0, &native_bounds); 347 dc, SP_PANE, 1, 0, &native_bounds);
348 canvas->endPlatformPaint(); 348 canvas->endPlatformPaint();
349 } 349 }
350 } 350 }
351 351
352 int DialogClientView::GetButtonWidth(int button) const { 352 int DialogClientView::GetButtonWidth(int button) const {
353 DialogDelegate* dd = GetDialogDelegate(); 353 DialogDelegate* dd = GetDialogDelegate();
354 std::wstring button_label = dd->GetDialogButtonLabel( 354 std::wstring button_label = dd->GetDialogButtonLabel(
355 static_cast<DialogDelegate::DialogButton>(button)); 355 static_cast<DialogDelegate::DialogButton>(button));
356 int string_width = dialog_button_font_.GetStringWidth(button_label); 356 int string_width = dialog_button_font_->GetStringWidth(button_label);
357 return std::max(string_width + kDialogButtonLabelSpacing, 357 return std::max(string_width + kDialogButtonLabelSpacing,
358 kDialogMinButtonWidth); 358 kDialogMinButtonWidth);
359 } 359 }
360 360
361 int DialogClientView::GetButtonsHeight() const { 361 int DialogClientView::GetButtonsHeight() const {
362 if (has_dialog_buttons()) { 362 if (has_dialog_buttons()) {
363 if (cancel_button_) 363 if (cancel_button_)
364 return cancel_button_->height() + kDialogButtonContentSpacing; 364 return cancel_button_->height() + kDialogButtonContentSpacing;
365 return ok_button_->height() + kDialogButtonContentSpacing; 365 return ok_button_->height() + kDialogButtonContentSpacing;
366 } 366 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 DialogDelegate* dd = window()->GetDelegate()->AsDialogDelegate(); 424 DialogDelegate* dd = window()->GetDelegate()->AsDialogDelegate();
425 DCHECK(dd); 425 DCHECK(dd);
426 return dd; 426 return dd;
427 } 427 }
428 428
429 // static 429 // static
430 void DialogClientView::InitClass() { 430 void DialogClientView::InitClass() {
431 static bool initialized = false; 431 static bool initialized = false;
432 if (!initialized) { 432 if (!initialized) {
433 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 433 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
434 dialog_button_font_ = rb.GetFont(ResourceBundle::BaseFont); 434 dialog_button_font_ = new ChromeFont(rb.GetFont(ResourceBundle::BaseFont));
435 initialized = true; 435 initialized = true;
436 } 436 }
437 } 437 }
438 438
439 } // namespace views 439 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/window/dialog_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698