| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ | 5 #ifndef UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ |
| 6 #define UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ | 6 #define UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/base/models/combobox_model.h" | 10 #include "ui/base/models/combobox_model.h" |
| 11 #include "ui/views/controls/combobox/combobox_listener.h" | 11 #include "ui/views/controls/combobox/combobox_listener.h" |
| 12 #include "ui/views/examples/example_base.h" | 12 #include "ui/views/examples/example_base.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 namespace examples { | 15 namespace examples { |
| 16 | 16 |
| 17 // A combobox model implementation that generates a list of "Item <index>". | 17 // A combobox model implementation that generates a list of "Item <index>". |
| 18 class ComboboxModelExample : public ui::ComboboxModel { | 18 class ComboboxModelExample : public ui::ComboboxModel { |
| 19 public: | 19 public: |
| 20 ComboboxModelExample(); | 20 ComboboxModelExample(); |
| 21 virtual ~ComboboxModelExample(); | 21 virtual ~ComboboxModelExample(); |
| 22 | 22 |
| 23 // Overridden from ui::ComboboxModel: | 23 // Overridden from ui::ComboboxModel: |
| 24 virtual int GetItemCount() const OVERRIDE; | 24 virtual int GetItemCount() const OVERRIDE; |
| 25 virtual string16 GetItemAt(int index) OVERRIDE; | 25 virtual base::string16 GetItemAt(int index) OVERRIDE; |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 DISALLOW_COPY_AND_ASSIGN(ComboboxModelExample); | 28 DISALLOW_COPY_AND_ASSIGN(ComboboxModelExample); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 class ComboboxExample : public ExampleBase, public ComboboxListener { | 31 class ComboboxExample : public ExampleBase, public ComboboxListener { |
| 32 public: | 32 public: |
| 33 ComboboxExample(); | 33 ComboboxExample(); |
| 34 virtual ~ComboboxExample(); | 34 virtual ~ComboboxExample(); |
| 35 | 35 |
| 36 // Overridden from ExampleBase: | 36 // Overridden from ExampleBase: |
| 37 virtual void CreateExampleView(View* container) OVERRIDE; | 37 virtual void CreateExampleView(View* container) OVERRIDE; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // Overridden from ComboboxListener: | 40 // Overridden from ComboboxListener: |
| 41 virtual void OnSelectedIndexChanged(Combobox* combobox) OVERRIDE; | 41 virtual void OnSelectedIndexChanged(Combobox* combobox) OVERRIDE; |
| 42 | 42 |
| 43 ComboboxModelExample combobox_model_; | 43 ComboboxModelExample combobox_model_; |
| 44 Combobox* combobox_; | 44 Combobox* combobox_; |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(ComboboxExample); | 46 DISALLOW_COPY_AND_ASSIGN(ComboboxExample); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace examples | 49 } // namespace examples |
| 50 } // namespace views | 50 } // namespace views |
| 51 | 51 |
| 52 #endif // UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ | 52 #endif // UI_VIEWS_EXAMPLES_COMBOBOX_EXAMPLE_H_ |
| OLD | NEW |