OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/combo_box.h" | 5 #include "views/controls/combo_box.h" |
6 | 6 |
7 #include "app/gfx/chrome_canvas.h" | 7 #include "app/gfx/chrome_canvas.h" |
8 #include "app/gfx/chrome_font.h" | 8 #include "app/gfx/chrome_font.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 return 0; | 109 return 0; |
110 } | 110 } |
111 | 111 |
112 LRESULT ComboBox::OnNotify(int w_param, LPNMHDR l_param) { | 112 LRESULT ComboBox::OnNotify(int w_param, LPNMHDR l_param) { |
113 return 0; | 113 return 0; |
114 } | 114 } |
115 | 115 |
116 void ComboBox::UpdateComboBoxFromModel(HWND hwnd) { | 116 void ComboBox::UpdateComboBoxFromModel(HWND hwnd) { |
117 ::SendMessage(hwnd, CB_RESETCONTENT, 0, 0); | 117 ::SendMessage(hwnd, CB_RESETCONTENT, 0, 0); |
118 ChromeFont font = ResourceBundle::GetSharedInstance().GetFont( | 118 gfx::Font font = ResourceBundle::GetSharedInstance().GetFont( |
119 ResourceBundle::BaseFont); | 119 ResourceBundle::BaseFont); |
120 int max_width = 0; | 120 int max_width = 0; |
121 int num_items = model_->GetItemCount(this); | 121 int num_items = model_->GetItemCount(this); |
122 for (int i = 0; i < num_items; ++i) { | 122 for (int i = 0; i < num_items; ++i) { |
123 const std::wstring& text = model_->GetItemAt(this, i); | 123 const std::wstring& text = model_->GetItemAt(this, i); |
124 | 124 |
125 // Inserting the Unicode formatting characters if necessary so that the | 125 // Inserting the Unicode formatting characters if necessary so that the |
126 // text is displayed correctly in right-to-left UIs. | 126 // text is displayed correctly in right-to-left UIs. |
127 std::wstring localized_text; | 127 std::wstring localized_text; |
128 const wchar_t* text_ptr = text.c_str(); | 128 const wchar_t* text_ptr = text.c_str(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // ComboBox::Model can be safely searched for and selected (which is what | 170 // ComboBox::Model can be safely searched for and selected (which is what |
171 // CB_SELECTSTRING does). | 171 // CB_SELECTSTRING does). |
172 ::SendMessage(hwnd, CB_SETCURSEL, selected_item_, 0); | 172 ::SendMessage(hwnd, CB_SETCURSEL, selected_item_, 0); |
173 } | 173 } |
174 | 174 |
175 int ComboBox::GetSelectedItem() { | 175 int ComboBox::GetSelectedItem() { |
176 return selected_item_; | 176 return selected_item_; |
177 } | 177 } |
178 | 178 |
179 } // namespace views | 179 } // namespace views |
OLD | NEW |