| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/combobox/native_combobox_gtk.h" | 5 #include "views/controls/combobox/native_combobox_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 GtkListStore* store = | 38 GtkListStore* store = |
| 39 GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(native_view()))); | 39 GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(native_view()))); |
| 40 ComboboxModel* model = combobox_->model(); | 40 ComboboxModel* model = combobox_->model(); |
| 41 int count = model->GetItemCount(); | 41 int count = model->GetItemCount(); |
| 42 gtk_list_store_clear(store); | 42 gtk_list_store_clear(store); |
| 43 GtkTreeIter iter; | 43 GtkTreeIter iter; |
| 44 while (count-- > 0) { | 44 while (count-- > 0) { |
| 45 gtk_list_store_prepend(store, &iter); | 45 gtk_list_store_prepend(store, &iter); |
| 46 gtk_list_store_set(store, &iter, | 46 gtk_list_store_set(store, &iter, |
| 47 0, WideToUTF8(model->GetItemAt(count)).c_str(), | 47 0, UTF16ToUTF8(model->GetItemAt(count)).c_str(), |
| 48 -1); | 48 -1); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 void NativeComboboxGtk::UpdateSelectedItem() { | 52 void NativeComboboxGtk::UpdateSelectedItem() { |
| 53 if (!native_view()) | 53 if (!native_view()) |
| 54 return; | 54 return; |
| 55 gtk_combo_box_set_active( | 55 gtk_combo_box_set_active( |
| 56 GTK_COMBO_BOX(native_view()), combobox_->selected_item()); | 56 GTK_COMBO_BOX(native_view()), combobox_->selected_item()); |
| 57 } | 57 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 //////////////////////////////////////////////////////////////////////////////// | 139 //////////////////////////////////////////////////////////////////////////////// |
| 140 // NativeComboboxWrapper, public: | 140 // NativeComboboxWrapper, public: |
| 141 | 141 |
| 142 // static | 142 // static |
| 143 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 143 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 144 Combobox* combobox) { | 144 Combobox* combobox) { |
| 145 return new NativeComboboxGtk(combobox); | 145 return new NativeComboboxGtk(combobox); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace views | 148 } // namespace views |
| OLD | NEW |