1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_
6 #define UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/base/models/combobox_model.h"
11 #include "ui/views/controls/combobox/combobox_listener.h"
12 #include "ui/views/examples/example_base.h"
17 // A combobox model implementation that generates a list of "Item <index>".
18 class ComboboxModelExample
: public ui::ComboboxModel
{
20 ComboboxModelExample();
21 virtual ~ComboboxModelExample();
23 // Overridden from ui::ComboboxModel:
24 virtual int GetItemCount() const OVERRIDE
;
25 virtual base::string16
GetItemAt(int index
) OVERRIDE
;
28 DISALLOW_COPY_AND_ASSIGN(ComboboxModelExample
);
31 class ComboboxExample
: public ExampleBase
, public ComboboxListener
{
34 virtual ~ComboboxExample();
36 // Overridden from ExampleBase:
37 virtual void CreateExampleView(View
* container
) OVERRIDE
;
40 // Overridden from ComboboxListener:
41 virtual void OnSelectedIndexChanged(Combobox
* combobox
) OVERRIDE
;
43 ComboboxModelExample combobox_model_
;
46 DISALLOW_COPY_AND_ASSIGN(ComboboxExample
);
49 } // namespace examples
52 #endif // UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_