OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "views/examples/combobox_example.h" | 5 #include "views/examples/combobox_example.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "ui/base/models/combobox_model.h" | 9 #include "ui/base/models/combobox_model.h" |
10 #include "views/fill_layout.h" | |
11 | 10 |
12 namespace { | 11 namespace { |
13 | 12 |
14 // An sample combobox model that generates list of "Item <index>". | 13 // An sample combobox model that generates list of "Item <index>". |
15 class ComboboxModelExample : public ui::ComboboxModel { | 14 class ComboboxModelExample : public ui::ComboboxModel { |
16 public: | 15 public: |
17 ComboboxModelExample() {} | 16 ComboboxModelExample() {} |
18 virtual ~ComboboxModelExample() {} | 17 virtual ~ComboboxModelExample() {} |
19 | 18 |
20 // Overridden from ui::ComboboxModel: | 19 // Overridden from ui::ComboboxModel: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 53 |
55 void ComboboxExample::ItemChanged(views::Combobox* combo_box, | 54 void ComboboxExample::ItemChanged(views::Combobox* combo_box, |
56 int prev_index, | 55 int prev_index, |
57 int new_index) { | 56 int new_index) { |
58 PrintStatus(L"Selected: index=%d, label=%ls", | 57 PrintStatus(L"Selected: index=%d, label=%ls", |
59 new_index, UTF16ToWideHack( | 58 new_index, UTF16ToWideHack( |
60 combo_box->model()->GetItemAt(new_index)).c_str()); | 59 combo_box->model()->GetItemAt(new_index)).c_str()); |
61 } | 60 } |
62 | 61 |
63 } // namespace examples | 62 } // namespace examples |
OLD | NEW |