| 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 "ui/views/controls/combobox/native_combobox_win.h" | 5 #include "ui/views/controls/combobox/native_combobox_win.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.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 "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Note that we use CB_SETCURSEL and not CB_SELECTSTRING because on RTL | 79 // Note that we use CB_SETCURSEL and not CB_SELECTSTRING because on RTL |
| 80 // locales the strings we get from our ComboBox::Model might be augmented | 80 // locales the strings we get from our ComboBox::Model might be augmented |
| 81 // with Unicode directionality marks before we insert them into the combo box | 81 // with Unicode directionality marks before we insert them into the combo box |
| 82 // and therefore we can not assume that the string we get from | 82 // and therefore we can not assume that the string we get from |
| 83 // ComboBox::Model can be safely searched for and selected (which is what | 83 // ComboBox::Model can be safely searched for and selected (which is what |
| 84 // CB_SELECTSTRING does). | 84 // CB_SELECTSTRING does). |
| 85 SendMessage(native_view(), CB_SETCURSEL, combobox_->selected_item(), 0); | 85 SendMessage(native_view(), CB_SETCURSEL, combobox_->selected_item(), 0); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void NativeComboboxWin::UpdateEnabled() { | 88 void NativeComboboxWin::UpdateEnabled() { |
| 89 SetEnabled(combobox_->IsEnabled()); | 89 SetEnabled(combobox_->enabled()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 int NativeComboboxWin::GetSelectedItem() const { | 92 int NativeComboboxWin::GetSelectedItem() const { |
| 93 LRESULT selected_item = SendMessage(native_view(), CB_GETCURSEL, 0, 0); | 93 LRESULT selected_item = SendMessage(native_view(), CB_GETCURSEL, 0, 0); |
| 94 return selected_item != CB_ERR ? selected_item : -1; | 94 return selected_item != CB_ERR ? selected_item : -1; |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool NativeComboboxWin::IsDropdownOpen() const { | 97 bool NativeComboboxWin::IsDropdownOpen() const { |
| 98 return SendMessage(native_view(), CB_GETDROPPEDSTATE, 0, 0) != 0; | 98 return SendMessage(native_view(), CB_GETDROPPEDSTATE, 0, 0) != 0; |
| 99 } | 99 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 // static | 207 // static |
| 208 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 208 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 209 Combobox* combobox) { | 209 Combobox* combobox) { |
| 210 if (Widget::IsPureViews()) | 210 if (Widget::IsPureViews()) |
| 211 return new NativeComboboxViews(combobox); | 211 return new NativeComboboxViews(combobox); |
| 212 return new NativeComboboxWin(combobox); | 212 return new NativeComboboxWin(combobox); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace views | 215 } // namespace views |
| OLD | NEW |