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

Side by Side Diff: chrome/browser/views/confirm_message_box_dialog.cc

Issue 390005: Fixed a label alignment issue in ConfirmMessageBoxDialog. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « no previous file | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/views/confirm_message_box_dialog.h" 5 #include "chrome/browser/views/confirm_message_box_dialog.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h" 8 #include "app/message_box_flags.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/locale_settings.h" 10 #include "grit/locale_settings.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 window_title_(window_title), 52 window_title_(window_title),
53 preferred_size_(gfx::Size(views::Window::GetLocalizedContentsSize( 53 preferred_size_(gfx::Size(views::Window::GetLocalizedContentsSize(
54 IDS_CONFIRM_MESSAGE_BOX_DEFAULT_WIDTH_CHARS, 54 IDS_CONFIRM_MESSAGE_BOX_DEFAULT_WIDTH_CHARS,
55 IDS_CONFIRM_MESSAGE_BOX_DEFAULT_HEIGHT_LINES))), 55 IDS_CONFIRM_MESSAGE_BOX_DEFAULT_HEIGHT_LINES))),
56 confirm_label_(l10n_util::GetString( 56 confirm_label_(l10n_util::GetString(
57 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)), 57 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)),
58 reject_label_(l10n_util::GetString( 58 reject_label_(l10n_util::GetString(
59 IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)) { 59 IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)) {
60 message_label_ = new views::Label(message_text); 60 message_label_ = new views::Label(message_text);
61 message_label_->SetMultiLine(true); 61 message_label_->SetMultiLine(true);
62 l10n_util::TextDirection direction = 62 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
63 l10n_util::GetFirstStrongCharacterDirection(message_label_->GetText());
64 views::Label::Alignment alignment;
65 if (direction == l10n_util::RIGHT_TO_LEFT)
66 alignment = views::Label::ALIGN_RIGHT;
67 else
68 alignment = views::Label::ALIGN_LEFT;
69 // In addition, we should set the RTL alignment mode as
70 // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around
71 // in RTL locales.
72 message_label_->SetRTLAlignmentMode(views::Label::AUTO_DETECT_ALIGNMENT);
73 message_label_->SetHorizontalAlignment(alignment);
74 AddChildView(message_label_); 63 AddChildView(message_label_);
75 } 64 }
76 65
77 int ConfirmMessageBoxDialog::GetDialogButtons() const { 66 int ConfirmMessageBoxDialog::GetDialogButtons() const {
78 return MessageBoxFlags::DIALOGBUTTON_OK | 67 return MessageBoxFlags::DIALOGBUTTON_OK |
79 MessageBoxFlags::DIALOGBUTTON_CANCEL; 68 MessageBoxFlags::DIALOGBUTTON_CANCEL;
80 } 69 }
81 70
82 std::wstring ConfirmMessageBoxDialog::GetWindowTitle() const { 71 std::wstring ConfirmMessageBoxDialog::GetWindowTitle() const {
83 return window_title_; 72 return window_title_;
(...skipping 21 matching lines...) Expand all
105 94
106 void ConfirmMessageBoxDialog::Layout() { 95 void ConfirmMessageBoxDialog::Layout() {
107 gfx::Size sz = message_label_->GetPreferredSize(); 96 gfx::Size sz = message_label_->GetPreferredSize();
108 message_label_->SetBounds(kPanelHorizMargin, kPanelVertMargin, 97 message_label_->SetBounds(kPanelHorizMargin, kPanelVertMargin,
109 width() - 2 * kPanelHorizMargin, 98 width() - 2 * kPanelHorizMargin,
110 sz.height()); 99 sz.height());
111 } 100 }
112 101
113 gfx::Size ConfirmMessageBoxDialog::GetPreferredSize() { 102 gfx::Size ConfirmMessageBoxDialog::GetPreferredSize() {
114 return preferred_size_; 103 return preferred_size_;
115 } 104 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698