Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: views/examples/combobox_example.h

Issue 6366008: views: Move implementations of ComboboxExample and SliderExample to source file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: next line Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | views/examples/combobox_example.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | views/examples/combobox_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698