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

Side by Side Diff: ui/views/examples/examples_window.cc

Issue 9965017: views: Rename ComboboxListener::ItemChanged to something more accurate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: combo_box -> combobox Created 8 years, 8 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
« no previous file with comments | « ui/views/examples/combobox_example.cc ('k') | ui/views/examples/native_theme_button_example.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/examples/examples_window.h" 5 #include "ui/views/examples/examples_window.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/i18n/icu_util.h" 9 #include "base/i18n/icu_util.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Overridden from View: 110 // Overridden from View:
111 virtual void ViewHierarchyChanged(bool is_add, 111 virtual void ViewHierarchyChanged(bool is_add,
112 View* parent, 112 View* parent,
113 View* child) OVERRIDE { 113 View* child) OVERRIDE {
114 if (is_add && child == this) 114 if (is_add && child == this)
115 InitExamplesWindow(); 115 InitExamplesWindow();
116 } 116 }
117 117
118 // Overridden from ComboboxListener: 118 // Overridden from ComboboxListener:
119 virtual void ItemChanged(Combobox* combo_box, 119 virtual void OnSelectedIndexChanged(Combobox* combobox) OVERRIDE {
120 int prev_index, 120 DCHECK_EQ(combobox, combobox_);
121 int new_index) OVERRIDE { 121 DCHECK(combobox->selected_index() < combobox_model_.GetItemCount());
122 DCHECK(combo_box && combo_box == combobox_);
123 DCHECK(new_index < combobox_model_.GetItemCount());
124 example_shown_->RemoveAllChildViews(false); 122 example_shown_->RemoveAllChildViews(false);
125 example_shown_->AddChildView(combobox_model_.GetItemViewAt(new_index)); 123 example_shown_->AddChildView(combobox_model_.GetItemViewAt(
124 combobox->selected_index()));
126 example_shown_->RequestFocus(); 125 example_shown_->RequestFocus();
127 SetStatus(std::string()); 126 SetStatus(std::string());
128 Layout(); 127 Layout();
129 } 128 }
130 129
131 // Creates the layout within the examples window. 130 // Creates the layout within the examples window.
132 void InitExamplesWindow() { 131 void InitExamplesWindow() {
133 AddExamples(); 132 AddExamples();
134 133
135 set_background(Background::CreateStandardPanelBackground()); 134 set_background(Background::CreateStandardPanelBackground());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 gfx::Rect(0, 0, 850, 300))->Show(); 202 gfx::Rect(0, 0, 850, 300))->Show();
204 } 203 }
205 } 204 }
206 205
207 void LogStatus(const std::string& string) { 206 void LogStatus(const std::string& string) {
208 ExamplesWindowContents::instance()->SetStatus(string); 207 ExamplesWindowContents::instance()->SetStatus(string);
209 } 208 }
210 209
211 } // namespace examples 210 } // namespace examples
212 } // namespace views 211 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/combobox_example.cc ('k') | ui/views/examples/native_theme_button_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698