Chromium Code Reviews| Index: views/examples/combobox_example.h |
| diff --git a/views/examples/combobox_example.h b/views/examples/combobox_example.h |
| index 35e85c0e1f44e73f33f8b743dd2d65d387b1265b..b8f024e8103af51060c158e4ab34d66be2d58cc5 100644 |
| --- a/views/examples/combobox_example.h |
| +++ b/views/examples/combobox_example.h |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @@ -6,63 +6,27 @@ |
| #define VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ |
| #pragma once |
| -#include "base/string_util.h" |
| -#include "base/utf_string_conversions.h" |
| -#include "ui/base/models/combobox_model.h" |
| +#include "base/compiler_specific.h" |
| #include "views/controls/combobox/combobox.h" |
| #include "views/examples/example_base.h" |
| #include "views/fill_layout.h" |
| -using ui::ComboboxModel; // TODO(beng): remove |
| - |
| namespace examples { |
| -// ComboboxExample |
| class ComboboxExample : public ExampleBase, public views::Combobox::Listener { |
|
oshima
2011/01/24 04:17:23
move Combobox::Listener to next line
tfarina
2011/01/24 12:23:53
Done.
|
| public: |
| - explicit ComboboxExample(ExamplesMain* main) : ExampleBase(main) { |
| - combobox_ = new views::Combobox(new ComboboxModelExample()); |
| - combobox_->set_listener(this); |
| - combobox_->SetSelectedItem(3); |
| - } |
| - virtual ~ComboboxExample() {} |
| - |
| - virtual std::wstring GetExampleTitle() { |
| - return L"Combo Box"; |
| - } |
| + explicit ComboboxExample(ExamplesMain* main); |
| + virtual ~ComboboxExample(); |
| - virtual void CreateExampleView(views::View* container) { |
| - container->SetLayoutManager(new views::FillLayout); |
| - container->AddChildView(combobox_); |
| - } |
| + // Overridden from ExampleBase: |
| + virtual std::wstring GetExampleTitle() OVERRIDE; |
| + virtual void CreateExampleView(views::View* container) OVERRIDE; |
| private: |
| - // An sample combobox model that generates list of "Item <index>". |
| - class ComboboxModelExample : public ComboboxModel { |
| - public: |
| - ComboboxModelExample() {} |
| - virtual ~ComboboxModelExample() {} |
| - |
| - virtual int GetItemCount() { |
| - return 10; |
| - } |
| - |
| - virtual string16 GetItemAt(int index) { |
| - return WideToUTF16Hack(StringPrintf(L"Item %d", index)); |
| - } |
| - |
| - private: |
| - DISALLOW_COPY_AND_ASSIGN(ComboboxModelExample); |
| - }; |
| - |
| - // Lister implementation. |
| + // Overridden from views::Combobox::Listener: |
| virtual void ItemChanged(views::Combobox* combo_box, |
| int prev_index, |
| - int new_index) { |
| - PrintStatus(L"Selected: index=%d, label=%ls", |
| - new_index, UTF16ToWideHack( |
| - combo_box->model()->GetItemAt(new_index)).c_str()); |
| - } |
| + int new_index) OVERRIDE; |
| // This test only control. |
| views::Combobox* combobox_; |