| Index: views/examples/combobox_example.h
|
| diff --git a/views/examples/combobox_example.h b/views/examples/combobox_example.h
|
| index 35e85c0e1f44e73f33f8b743dd2d65d387b1265b..127c507826f6bb7e2e34a9ef6e1f7044834b3e7c 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,28 @@
|
| #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 {
|
| +class ComboboxExample : public ExampleBase,
|
| + public views::Combobox::Listener {
|
| 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_;
|
|
|