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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 9875001: views: Rename Combobox "selected getter/setter" accessors to something more accurate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: combo box -> combobox 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index 2b906c9e6b50abd3e37cbb3b1e2301b38df740e2..697def58bbdf49432417d1dc908ea42d79b1f11c 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -26,7 +26,8 @@ Combobox::Combobox(ui::ComboboxModel* model)
: native_wrapper_(NULL),
model_(model),
listener_(NULL),
- selected_item_(0) {
+ selected_index_(0) {
+ DCHECK(model);
set_focusable(true);
}
@@ -40,23 +41,23 @@ const gfx::Font& Combobox::GetFont() {
}
void Combobox::ModelChanged() {
- selected_item_ = std::min(0, model_->GetItemCount());
+ selected_index_ = std::min(0, model_->GetItemCount());
if (native_wrapper_)
native_wrapper_->UpdateFromModel();
PreferredSizeChanged();
}
-void Combobox::SetSelectedItem(int index) {
- selected_item_ = index;
+void Combobox::SetSelectedIndex(int index) {
+ selected_index_ = index;
if (native_wrapper_)
- native_wrapper_->UpdateSelectedItem();
+ native_wrapper_->UpdateSelectedIndex();
}
void Combobox::SelectionChanged() {
- int prev_selected_item = selected_item_;
- selected_item_ = native_wrapper_->GetSelectedItem();
+ int prev_selected_index = selected_index_;
+ selected_index_ = native_wrapper_->GetSelectedIndex();
if (listener_)
- listener_->ItemChanged(this, prev_selected_item, selected_item_);
+ listener_->ItemChanged(this, prev_selected_index, selected_index_);
if (GetWidget()) {
GetWidget()->NotifyAccessibilityEvent(
this, ui::AccessibilityTypes::EVENT_VALUE_CHANGED, false);
@@ -129,8 +130,8 @@ void Combobox::OnBlur() {
void Combobox::GetAccessibleState(ui::AccessibleViewState* state) {
state->role = ui::AccessibilityTypes::ROLE_COMBOBOX;
state->name = accessible_name_;
- state->value = model_->GetItemAt(selected_item_);
- state->index = selected_item();
+ state->value = model_->GetItemAt(selected_index_);
+ state->index = selected_index_;
state->count = model()->GetItemCount();
}
@@ -144,7 +145,7 @@ void Combobox::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
// parented. For this reason the wrapper is only updated after adding its
// view.
native_wrapper_->UpdateFromModel();
- native_wrapper_->UpdateSelectedItem();
+ native_wrapper_->UpdateSelectedIndex();
native_wrapper_->UpdateEnabled();
}
}
« 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