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 "views/controls/combobox/combobox.h" | 5 #include "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" |
(...skipping 10 matching lines...) Expand all Loading... |
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(ComboboxModel* model) | 26 Combobox::Combobox(ComboboxModel* model) |
27 : native_wrapper_(NULL), | 27 : native_wrapper_(NULL), |
28 model_(model), | 28 model_(model), |
29 listener_(NULL), | 29 listener_(NULL), |
30 selected_item_(0) { | 30 selected_item_(0) { |
31 SetFocusable(true); | 31 set_focusable(true); |
32 } | 32 } |
33 | 33 |
34 Combobox::~Combobox() { | 34 Combobox::~Combobox() { |
35 } | 35 } |
36 | 36 |
37 void Combobox::ModelChanged() { | 37 void Combobox::ModelChanged() { |
38 selected_item_ = std::min(0, model_->GetItemCount()); | 38 selected_item_ = std::min(0, model_->GetItemCount()); |
39 if (native_wrapper_) | 39 if (native_wrapper_) |
40 native_wrapper_->UpdateFromModel(); | 40 native_wrapper_->UpdateFromModel(); |
41 PreferredSizeChanged(); | 41 PreferredSizeChanged(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); | 135 native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); |
136 AddChildView(native_wrapper_->GetView()); | 136 AddChildView(native_wrapper_->GetView()); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 std::string Combobox::GetClassName() const { | 140 std::string Combobox::GetClassName() const { |
141 return kViewClassName; | 141 return kViewClassName; |
142 } | 142 } |
143 | 143 |
144 } // namespace views | 144 } // namespace views |
OLD | NEW |