diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 16:29:32 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 16:29:32 +0000 |
commit | 2e1c2685a12d6c38089b07c3f6359e036736cabf (patch) | |
tree | bb5e3a3a1f28ca19f23f19874a206004f2fe6cec /views | |
parent | 355e36f7b919a9dd3cfc1244cf91a497e301ffcd (diff) | |
download | chromium_src-2e1c2685a12d6c38089b07c3f6359e036736cabf.zip chromium_src-2e1c2685a12d6c38089b07c3f6359e036736cabf.tar.gz chromium_src-2e1c2685a12d6c38089b07c3f6359e036736cabf.tar.bz2 |
views: Change Checkbox API to string16.
BUG=68267
R=sky@chromium.org
Review URL: http://codereview.chromium.org/8245006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/checkbox.cc | 5 | ||||
-rw-r--r-- | views/controls/button/checkbox.h | 5 | ||||
-rw-r--r-- | views/controls/button/radio_button.cc | 3 | ||||
-rw-r--r-- | views/controls/message_box_view.cc | 2 | ||||
-rw-r--r-- | views/examples/native_theme_checkbox_example.cc | 5 | ||||
-rw-r--r-- | views/examples/table2_example.cc | 12 | ||||
-rw-r--r-- | views/examples/table_example.cc | 12 | ||||
-rw-r--r-- | views/examples/text_example.cc | 8 | ||||
-rw-r--r-- | views/focus/focus_manager_unittest.cc | 12 | ||||
-rw-r--r-- | views/view_unittest.cc | 2 |
10 files changed, 38 insertions, 28 deletions
diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index 252fdc8..6eb683d 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -5,6 +5,7 @@ #include "views/controls/button/checkbox.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "views/controls/label.h" @@ -19,8 +20,8 @@ static const int kCheckboxLabelSpacing = 4; //////////////////////////////////////////////////////////////////////////////// // Checkbox, public: -Checkbox::Checkbox(const std::wstring& label) - : TextButtonBase(NULL, label), +Checkbox::Checkbox(const string16& label) + : TextButtonBase(NULL, UTF16ToWideHack(label)), checked_(false) { set_border(new TextButtonNativeThemeBorder(this)); set_focusable(true); diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h index 2916c54..723f1ea 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -8,6 +8,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/string16.h" #include "views/controls/button/text_button.h" namespace views { @@ -16,10 +18,9 @@ namespace views { // platform specific objects to replicate the native platforms looks and feel. class VIEWS_EXPORT Checkbox : public TextButtonBase { public: - // The button's class name. static const char kViewClassName[]; - explicit Checkbox(const std::wstring& label); + explicit Checkbox(const string16& label); virtual ~Checkbox(); // Sets a listener for this checkbox. Checkboxes aren't required to have them diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc index ebf16cd..170d010 100644 --- a/views/controls/button/radio_button.cc +++ b/views/controls/button/radio_button.cc @@ -5,7 +5,6 @@ #include "views/controls/button/radio_button.h" #include "base/logging.h" -#include "base/utf_string_conversions.h" #include "ui/base/accessibility/accessible_view_state.h" #include "views/widget/widget.h" @@ -15,7 +14,7 @@ namespace views { const char RadioButton::kViewClassName[] = "views/RadioButton"; RadioButton::RadioButton(const string16& label, int group_id) - : Checkbox(UTF16ToWideHack(label)) { + : Checkbox(label) { SetGroup(group_id); set_focusable(true); } diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index 5862460..b64952f 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -71,7 +71,7 @@ void MessageBoxView::SetIcon(const SkBitmap& icon) { void MessageBoxView::SetCheckBoxLabel(const string16& label) { if (!checkbox_) - checkbox_ = new Checkbox(UTF16ToWideHack(label)); + checkbox_ = new Checkbox(label); else checkbox_->SetText(UTF16ToWideHack(label)); ResetLayoutManager(); diff --git a/views/examples/native_theme_checkbox_example.cc b/views/examples/native_theme_checkbox_example.cc index ac09a2d..253cd9d 100644 --- a/views/examples/native_theme_checkbox_example.cc +++ b/views/examples/native_theme_checkbox_example.cc @@ -5,6 +5,7 @@ #include "views/examples/native_theme_checkbox_example.h" #include "base/stringprintf.h" +#include "base/utf_string_conversions.h" #include "views/controls/button/checkbox.h" #include "views/controls/button/radio_button.h" #include "views/layout/fill_layout.h" @@ -20,7 +21,7 @@ NativeThemeCheckboxExample::~NativeThemeCheckboxExample() { } void NativeThemeCheckboxExample::CreateExampleView(views::View* container) { - button_ = new views::Checkbox(L"Checkbox"); + button_ = new views::Checkbox(ASCIIToUTF16("Checkbox")); button_->set_listener(this); container->SetLayoutManager(new views::FillLayout); container->AddChildView(button_); @@ -28,7 +29,7 @@ void NativeThemeCheckboxExample::CreateExampleView(views::View* container) { void NativeThemeCheckboxExample::ButtonPressed(views::Button* sender, const views::Event& event) { - PrintStatus(base::StringPrintf("Pressed! count:%d", ++count_).c_str()); + PrintStatus(base::StringPrintf("Pressed! count: %d", ++count_).c_str()); } } // namespace examples diff --git a/views/examples/table2_example.cc b/views/examples/table2_example.cc index 028895b..393fb7f 100644 --- a/views/examples/table2_example.cc +++ b/views/examples/table2_example.cc @@ -20,16 +20,20 @@ Table2Example::~Table2Example() { } void Table2Example::CreateExampleView(views::View* container) { - column1_visible_checkbox_ = new views::Checkbox(L"Fruit column visible"); + column1_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Fruit column visible")); column1_visible_checkbox_->SetChecked(true); column1_visible_checkbox_->set_listener(this); - column2_visible_checkbox_ = new views::Checkbox(L"Color column visible"); + column2_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Color column visible")); column2_visible_checkbox_->SetChecked(true); column2_visible_checkbox_->set_listener(this); - column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); + column3_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Origin column visible")); column3_visible_checkbox_->SetChecked(true); column3_visible_checkbox_->set_listener(this); - column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); + column4_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Price column visible")); column4_visible_checkbox_->SetChecked(true); column4_visible_checkbox_->set_listener(this); diff --git a/views/examples/table_example.cc b/views/examples/table_example.cc index e568514e..f2287dc 100644 --- a/views/examples/table_example.cc +++ b/views/examples/table_example.cc @@ -21,16 +21,20 @@ TableExample::~TableExample() { } void TableExample::CreateExampleView(views::View* container) { - column1_visible_checkbox_ = new views::Checkbox(L"Fruit column visible"); + column1_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Fruit column visible")); column1_visible_checkbox_->SetChecked(true); column1_visible_checkbox_->set_listener(this); - column2_visible_checkbox_ = new views::Checkbox(L"Color column visible"); + column2_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Color column visible")); column2_visible_checkbox_->SetChecked(true); column2_visible_checkbox_->set_listener(this); - column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); + column3_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Origin column visible")); column3_visible_checkbox_->SetChecked(true); column3_visible_checkbox_->set_listener(this); - column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); + column4_visible_checkbox_ = new views::Checkbox( + ASCIIToUTF16("Price column visible")); column4_visible_checkbox_->SetChecked(true); column4_visible_checkbox_->set_listener(this); diff --git a/views/examples/text_example.cc b/views/examples/text_example.cc index cf484e8..e48fdc0 100644 --- a/views/examples/text_example.cc +++ b/views/examples/text_example.cc @@ -9,11 +9,11 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/canvas_skia.h" -#include "views/controls/label.h" #include "views/controls/button/checkbox.h" +#include "views/controls/label.h" #include "views/examples/example_combobox_model.h" -#include "views/view.h" #include "views/layout/grid_layout.h" +#include "views/view.h" namespace { @@ -193,10 +193,10 @@ void TextExample::CreateExampleView(views::View* container) { arraysize(kTextExamples)); layout->StartRow(0, 0); - multiline_checkbox_ = new views::Checkbox(L"Multiline"); + multiline_checkbox_ = new views::Checkbox(ASCIIToUTF16("Multiline")); multiline_checkbox_->set_listener(this); layout->AddView(multiline_checkbox_); - break_checkbox_ = new views::Checkbox(L"Character Break"); + break_checkbox_ = new views::Checkbox(ASCIIToUTF16("Character Break")); break_checkbox_->set_listener(this); layout->AddView(break_checkbox_); diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 5dd31c1..c60b8ee 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -476,7 +476,7 @@ void FocusTraversalTest::InitContentView() { content_view_->set_background( Background::CreateSolidBackground(SK_ColorWHITE)); - Checkbox* cb = new Checkbox(L"This is a checkbox"); + Checkbox* cb = new Checkbox(ASCIIToUTF16("This is a checkbox")); content_view_->AddChildView(cb); // In this fast paced world, who really has time for non hard-coded layout? cb->SetBounds(10, 10, 200, 20); @@ -555,7 +555,7 @@ void FocusTraversalTest::InitContentView() { left_container_->AddChildView(button); y += 40; - cb = new Checkbox(L"This is another check box"); + cb = new Checkbox(ASCIIToUTF16("This is another check box")); cb->SetBounds(label_x + label_width + 5, y, 180, 20); cb->set_id(kFruitCheckBoxID); left_container_->AddChildView(cb); @@ -666,17 +666,17 @@ void FocusTraversalTest::InitContentView() { // Left bottom box with style checkboxes. View* contents = new View(); contents->set_background(Background::CreateSolidBackground(SK_ColorWHITE)); - cb = new Checkbox(L"Bold"); + cb = new Checkbox(ASCIIToUTF16("Bold")); contents->AddChildView(cb); cb->SetBounds(10, 10, 50, 20); cb->set_id(kBoldCheckBoxID); - cb = new Checkbox(L"Italic"); + cb = new Checkbox(ASCIIToUTF16("Italic")); contents->AddChildView(cb); cb->SetBounds(70, 10, 50, 20); cb->set_id(kItalicCheckBoxID); - cb = new Checkbox(L"Underlined"); + cb = new Checkbox(ASCIIToUTF16("Underlined")); contents->AddChildView(cb); cb->SetBounds(130, 10, 70, 20); cb->set_id(kUnderlinedCheckBoxID); @@ -878,7 +878,7 @@ class TestNativeButton : public NativeTextButton { class TestCheckbox : public Checkbox { public: - explicit TestCheckbox(const std::wstring& text) : Checkbox(text) { + explicit TestCheckbox(const string16& text) : Checkbox(text) { }; virtual gfx::NativeView TestGetNativeControlView() { return GetWidget()->GetNativeView(); diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 45290cc..759d182 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1225,7 +1225,7 @@ class TestDialog : public DialogDelegate, public ButtonListener { contents_ = new View; button1_ = new NativeTextButton(this, L"Button1"); button2_ = new NativeTextButton(this, L"Button2"); - checkbox_ = new Checkbox(L"My checkbox"); + checkbox_ = new Checkbox(ASCIIToUTF16("My checkbox")); button_drop_ = new ButtonDropDown(this, mock_menu_model_); contents_->AddChildView(button1_); contents_->AddChildView(button2_); |