Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: views/controls/combobox/native_combobox_win.cc

Issue 3159031: Remove wstrings from bookmarks, part 12. (Closed)
Patch Set: rebased ToT Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « views/controls/combobox/native_combobox_gtk.cc ('k') | views/examples/combobox_example.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/controls/combobox/native_combobox_win.h" 5 #include "views/controls/combobox/native_combobox_win.h"
6 6
7 #include "app/combobox_model.h" 7 #include "app/combobox_model.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/utf_string_conversions.h"
10 #include "gfx/font.h" 11 #include "gfx/font.h"
11 #include "gfx/native_theme_win.h" 12 #include "gfx/native_theme_win.h"
12 #include "views/controls/combobox/combobox.h" 13 #include "views/controls/combobox/combobox.h"
13 #include "views/widget/widget.h" 14 #include "views/widget/widget.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 // Limit how small a combobox can be. 18 // Limit how small a combobox can be.
18 static const int kMinComboboxWidth = 148; 19 static const int kMinComboboxWidth = 148;
19 20
(...skipping 19 matching lines...) Expand all
39 //////////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////////
40 // NativeComboboxWin, NativeComboboxWrapper implementation: 41 // NativeComboboxWin, NativeComboboxWrapper implementation:
41 42
42 void NativeComboboxWin::UpdateFromModel() { 43 void NativeComboboxWin::UpdateFromModel() {
43 SendMessage(native_view(), CB_RESETCONTENT, 0, 0); 44 SendMessage(native_view(), CB_RESETCONTENT, 0, 0);
44 gfx::Font font = ResourceBundle::GetSharedInstance().GetFont( 45 gfx::Font font = ResourceBundle::GetSharedInstance().GetFont(
45 ResourceBundle::BaseFont); 46 ResourceBundle::BaseFont);
46 int max_width = 0; 47 int max_width = 0;
47 int num_items = combobox_->model()->GetItemCount(); 48 int num_items = combobox_->model()->GetItemCount();
48 for (int i = 0; i < num_items; ++i) { 49 for (int i = 0; i < num_items; ++i) {
49 const std::wstring& text = combobox_->model()->GetItemAt(i); 50 const std::wstring& text = UTF16ToWide(combobox_->model()->GetItemAt(i));
50 51
51 // Inserting the Unicode formatting characters if necessary so that the 52 // Inserting the Unicode formatting characters if necessary so that the
52 // text is displayed correctly in right-to-left UIs. 53 // text is displayed correctly in right-to-left UIs.
53 std::wstring localized_text; 54 std::wstring localized_text;
54 const wchar_t* text_ptr = text.c_str(); 55 const wchar_t* text_ptr = text.c_str();
55 if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text)) 56 if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text))
56 text_ptr = localized_text.c_str(); 57 text_ptr = localized_text.c_str();
57 58
58 SendMessage(native_view(), CB_ADDSTRING, 0, 59 SendMessage(native_view(), CB_ADDSTRING, 0,
59 reinterpret_cast<LPARAM>(text_ptr)); 60 reinterpret_cast<LPARAM>(text_ptr));
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 //////////////////////////////////////////////////////////////////////////////// 190 ////////////////////////////////////////////////////////////////////////////////
190 // NativeComboboxWrapper, public: 191 // NativeComboboxWrapper, public:
191 192
192 // static 193 // static
193 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( 194 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper(
194 Combobox* combobox) { 195 Combobox* combobox) {
195 return new NativeComboboxWin(combobox); 196 return new NativeComboboxWin(combobox);
196 } 197 }
197 198
198 } // namespace views 199 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/combobox/native_combobox_gtk.cc ('k') | views/examples/combobox_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698