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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return gfx::Size(); | 71 return gfx::Size(); |
72 } | 72 } |
73 | 73 |
74 void Combobox::Layout() { | 74 void Combobox::Layout() { |
75 if (native_wrapper_) { | 75 if (native_wrapper_) { |
76 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); | 76 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); |
77 native_wrapper_->GetView()->Layout(); | 77 native_wrapper_->GetView()->Layout(); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void Combobox::SetEnabled(bool flag) { | 81 void Combobox::OnEnabledChanged() { |
82 View::SetEnabled(flag); | 82 View::OnEnabledChanged(); |
83 if (native_wrapper_) | 83 if (native_wrapper_) |
84 native_wrapper_->UpdateEnabled(); | 84 native_wrapper_->UpdateEnabled(); |
85 } | 85 } |
86 | 86 |
87 // VKEY_ESCAPE should be handled by this view when the drop down list is active. | 87 // VKEY_ESCAPE should be handled by this view when the drop down list is active. |
88 // In other words, the list should be closed instead of the dialog. | 88 // In other words, the list should be closed instead of the dialog. |
89 bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { | 89 bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { |
90 if (e.key_code() != ui::VKEY_ESCAPE || | 90 if (e.key_code() != ui::VKEY_ESCAPE || |
91 e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { | 91 e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { |
92 return false; | 92 return false; |
(...skipping 42 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 |