diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-30 21:12:31 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-30 21:12:31 +0000 |
commit | d1c282439496501dcd9fa37708d8433e2b1d6ead (patch) | |
tree | 203e2fc8ccefdc1adcb9a34ee1cd0d32f19610f9 /ui/views/examples/text_example.cc | |
parent | d55adf9040f8053aca6d72eef931a34f14d62cfc (diff) | |
download | chromium_src-d1c282439496501dcd9fa37708d8433e2b1d6ead.zip chromium_src-d1c282439496501dcd9fa37708d8433e2b1d6ead.tar.gz chromium_src-d1c282439496501dcd9fa37708d8433e2b1d6ead.tar.bz2 |
views: Rename ComboboxListener::ItemChanged to something more accurate.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9965017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/examples/text_example.cc')
-rw-r--r-- | ui/views/examples/text_example.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc index 099201b..b5e3912 100644 --- a/ui/views/examples/text_example.cc +++ b/ui/views/examples/text_example.cc @@ -190,13 +190,14 @@ Combobox* TextExample::AddCombobox(GridLayout* layout, int count) { layout->StartRow(0, 0); layout->AddView(new Label(ASCIIToUTF16(name))); - ExampleComboboxModel* new_model = new ExampleComboboxModel(strings, count); - example_combobox_model_.push_back(new_model); - Combobox* combo_box = new Combobox(new_model); - combo_box->SetSelectedIndex(0); - combo_box->set_listener(this); - layout->AddView(combo_box, kNumColumns - 1, 1); - return combo_box; + ExampleComboboxModel* combobox_model = new ExampleComboboxModel(strings, + count); + example_combobox_model_.push_back(combobox_model); + Combobox* combobox = new Combobox(combobox_model); + combobox->SetSelectedIndex(0); + combobox->set_listener(this); + layout->AddView(combobox, kNumColumns - 1, 1); + return combobox; } void TextExample::CreateExampleView(View* container) { @@ -274,15 +275,13 @@ void TextExample::ButtonPressed(Button* button, text_view_->SchedulePaint(); } -void TextExample::ItemChanged(Combobox* combo_box, - int prev_index, - int new_index) { +void TextExample::OnSelectedIndexChanged(Combobox* combobox) { int text_flags = text_view_->text_flags(); - if (combo_box == h_align_cb_) { + if (combobox == h_align_cb_) { text_flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT | gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::TEXT_ALIGN_RIGHT); - switch (new_index) { + switch (combobox->selected_index()) { case 0: break; case 1: @@ -295,11 +294,11 @@ void TextExample::ItemChanged(Combobox* combo_box, text_flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; break; } - } else if (combo_box == v_align_cb_) { + } else if (combobox == v_align_cb_) { text_flags &= ~(gfx::Canvas::TEXT_VALIGN_TOP | gfx::Canvas::TEXT_VALIGN_MIDDLE | gfx::Canvas::TEXT_VALIGN_BOTTOM); - switch (new_index) { + switch (combobox->selected_index()) { case 0: break; case 1: @@ -312,8 +311,8 @@ void TextExample::ItemChanged(Combobox* combo_box, text_flags |= gfx::Canvas::TEXT_VALIGN_BOTTOM; break; } - } else if (combo_box == text_cb_) { - switch (new_index) { + } else if (combobox == text_cb_) { + switch (combobox->selected_index()) { case 0: text_view_->set_text(ASCIIToUTF16(kShortText)); break; @@ -330,8 +329,8 @@ void TextExample::ItemChanged(Combobox* combo_box, text_view_->set_text(ASCIIToUTF16(kNewlineText)); break; } - } else if (combo_box == eliding_cb_) { - switch (new_index) { + } else if (combobox == eliding_cb_) { + switch (combobox->selected_index()) { case 0: text_flags &= ~gfx::Canvas::NO_ELLIPSIS; text_view_->set_fade(false); @@ -355,9 +354,9 @@ void TextExample::ItemChanged(Combobox* combo_box, break; #endif } - } else if (combo_box == prefix_cb_) { + } else if (combobox == prefix_cb_) { text_flags &= ~(gfx::Canvas::SHOW_PREFIX | gfx::Canvas::HIDE_PREFIX); - switch (new_index) { + switch (combobox->selected_index()) { case 0: break; case 1: |