| OLD | NEW |
| 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/events/event.h" | 10 #include "ui/base/events/event.h" |
| 11 #include "ui/base/keycodes/keyboard_codes.h" | 11 #include "ui/base/keycodes/keyboard_codes.h" |
| 12 #include "ui/base/models/combobox_model.h" | 12 #include "ui/base/models/combobox_model.h" |
| 13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/views/controls/combobox/combobox_listener.h" | 14 #include "ui/views/controls/combobox/combobox_listener.h" |
| 15 #include "ui/views/controls/native/native_view_host.h" | 15 #include "ui/views/controls/native/native_view_host.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 const char Combobox::kViewClassName[] = "views/Combobox"; | 21 const char Combobox::kViewClassName[] = "views/Combobox"; |
| 22 | 22 |
| 23 //////////////////////////////////////////////////////////////////////////////// | 23 //////////////////////////////////////////////////////////////////////////////// |
| 24 // Combobox, public: | 24 // Combobox, public: |
| 25 | 25 |
| 26 Combobox::Combobox(ui::ComboboxModel* model) | 26 Combobox::Combobox(ui::ComboboxModel* model) |
| 27 : native_wrapper_(NULL), | 27 : native_wrapper_(NULL), |
| 28 model_(model), | 28 model_(model), |
| 29 listener_(NULL), | 29 listener_(NULL), |
| 30 selected_index_(0) { | 30 selected_index_(model_->GetDefaultIndex()) { |
| 31 DCHECK(model); | |
| 32 set_focusable(true); | 31 set_focusable(true); |
| 33 } | 32 } |
| 34 | 33 |
| 35 Combobox::~Combobox() { | 34 Combobox::~Combobox() { |
| 36 } | 35 } |
| 37 | 36 |
| 38 // static | 37 // static |
| 39 const gfx::Font& Combobox::GetFont() { | 38 const gfx::Font& Combobox::GetFont() { |
| 40 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 39 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 41 return rb.GetFont(ui::ResourceBundle::BaseFont); | 40 return rb.GetFont(ui::ResourceBundle::BaseFont); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 native_wrapper_->UpdateSelectedIndex(); | 147 native_wrapper_->UpdateSelectedIndex(); |
| 149 native_wrapper_->UpdateEnabled(); | 148 native_wrapper_->UpdateEnabled(); |
| 150 } | 149 } |
| 151 } | 150 } |
| 152 | 151 |
| 153 std::string Combobox::GetClassName() const { | 152 std::string Combobox::GetClassName() const { |
| 154 return kViewClassName; | 153 return kViewClassName; |
| 155 } | 154 } |
| 156 | 155 |
| 157 } // namespace views | 156 } // namespace views |
| OLD | NEW |