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

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

Issue 9839034: views: Refactor the way we get the combo box font. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: order Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/combobox.h" 5 #include "ui/views/controls/combobox/combobox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/base/accessibility/accessible_view_state.h" 9 #include "ui/base/accessibility/accessible_view_state.h"
10 #include "ui/base/keycodes/keyboard_codes.h" 10 #include "ui/base/keycodes/keyboard_codes.h"
11 #include "ui/base/models/combobox_model.h" 11 #include "ui/base/models/combobox_model.h"
12 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/views/controls/combobox/combobox_listener.h" 13 #include "ui/views/controls/combobox/combobox_listener.h"
13 #include "ui/views/controls/native/native_view_host.h" 14 #include "ui/views/controls/native/native_view_host.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 namespace views { 17 namespace views {
17 18
18 // static 19 // static
19 const char Combobox::kViewClassName[] = "views/Combobox"; 20 const char Combobox::kViewClassName[] = "views/Combobox";
20 21
21 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
22 // Combobox, public: 23 // Combobox, public:
23 24
24 Combobox::Combobox(ui::ComboboxModel* model) 25 Combobox::Combobox(ui::ComboboxModel* model)
25 : native_wrapper_(NULL), 26 : native_wrapper_(NULL),
26 model_(model), 27 model_(model),
27 listener_(NULL), 28 listener_(NULL),
28 selected_item_(0) { 29 selected_item_(0) {
29 set_focusable(true); 30 set_focusable(true);
30 } 31 }
31 32
32 Combobox::~Combobox() { 33 Combobox::~Combobox() {
33 } 34 }
34 35
36 // static
37 const gfx::Font& Combobox::GetFont() {
38 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
39 return rb.GetFont(ui::ResourceBundle::BaseFont);
40 }
41
35 void Combobox::ModelChanged() { 42 void Combobox::ModelChanged() {
36 selected_item_ = std::min(0, model_->GetItemCount()); 43 selected_item_ = std::min(0, model_->GetItemCount());
37 if (native_wrapper_) 44 if (native_wrapper_)
38 native_wrapper_->UpdateFromModel(); 45 native_wrapper_->UpdateFromModel();
39 PreferredSizeChanged(); 46 PreferredSizeChanged();
40 } 47 }
41 48
42 void Combobox::SetSelectedItem(int index) { 49 void Combobox::SetSelectedItem(int index) {
43 selected_item_ = index; 50 selected_item_ = index;
44 if (native_wrapper_) 51 if (native_wrapper_)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 native_wrapper_->UpdateSelectedItem(); 147 native_wrapper_->UpdateSelectedItem();
141 native_wrapper_->UpdateEnabled(); 148 native_wrapper_->UpdateEnabled();
142 } 149 }
143 } 150 }
144 151
145 std::string Combobox::GetClassName() const { 152 std::string Combobox::GetClassName() const {
146 return kViewClassName; 153 return kViewClassName;
147 } 154 }
148 155
149 } // namespace views 156 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox.h ('k') | ui/views/controls/combobox/native_combobox_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698