| Index: ui/views/examples/text_example.cc
|
| diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc
|
| index 099201bc4bed339262f993d57ebd0610a366fb97..b5e3912e74f396b156243703ad0f78be4aca3c71 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:
|
|
|