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

Side by Side Diff: views/controls/button/native_button_gtk.cc

Issue 6452011: Rework tree APIs to reflect Google style and more const-correctness.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « views/animation/bounds_animator.cc ('k') | views/controls/button/radio_button.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/button/native_button_gtk.h" 5 #include "views/controls/button/native_button_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // button is added to, or removed. 226 // button is added to, or removed.
227 DCHECK(group); 227 DCHECK(group);
228 GtkRadioButton* this_radio_button = GTK_RADIO_BUTTON(native_view()); 228 GtkRadioButton* this_radio_button = GTK_RADIO_BUTTON(native_view());
229 if (!g_slist_find(group, this_radio_button)) 229 if (!g_slist_find(group, this_radio_button))
230 gtk_radio_button_set_group(this_radio_button, group); 230 gtk_radio_button_set_group(this_radio_button, group);
231 } 231 }
232 232
233 //////////////////////////////////////////////////////////////////////////////// 233 ////////////////////////////////////////////////////////////////////////////////
234 // NativeRadioButtonGtk, NativeControlGtk overrides: 234 // NativeRadioButtonGtk, NativeControlGtk overrides:
235 void NativeRadioButtonGtk::ViewHierarchyChanged(bool is_add, 235 void NativeRadioButtonGtk::ViewHierarchyChanged(bool is_add,
236 View *parent, View *child) { 236 View* parent, View* child) {
237 NativeControlGtk::ViewHierarchyChanged(is_add, parent, child); 237 NativeControlGtk::ViewHierarchyChanged(is_add, parent, child);
238 238
239 // look for the same group and update 239 // look for the same group and update
240 if (is_add && child == this) { 240 if (is_add && child == this) {
241 View* container = GetParent(); 241 View* container = parent;
242 while (container && container->GetParent()) 242 while (container && container->parent())
243 container = container->GetParent(); 243 container = container->parent();
244 if (container) { 244 if (container) {
245 std::vector<View*> other; 245 std::vector<View*> other;
246 container->GetViewsWithGroup(native_button_->GetGroup(), &other); 246 container->GetViewsWithGroup(native_button_->GetGroup(), &other);
247 for (std::vector<View*>::iterator i = other.begin(); 247 for (std::vector<View*>::iterator i = other.begin();
248 i != other.end(); 248 i != other.end();
249 ++i) { 249 ++i) {
250 if (*i != native_button_) { 250 if (*i != native_button_) {
251 if ((*i)->GetClassName() != RadioButton::kViewClassName) { 251 if ((*i)->GetClassName() != RadioButton::kViewClassName) {
252 NOTREACHED() << "radio-button has same group as other non " 252 NOTREACHED() << "radio-button has same group as other non "
253 "radio-button views."; 253 "radio-button views.";
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 return new NativeCheckboxGtk(checkbox); 293 return new NativeCheckboxGtk(checkbox);
294 } 294 }
295 295
296 // static 296 // static
297 NativeButtonWrapper* NativeButtonWrapper::CreateRadioButtonWrapper( 297 NativeButtonWrapper* NativeButtonWrapper::CreateRadioButtonWrapper(
298 RadioButton* radio_button) { 298 RadioButton* radio_button) {
299 return new NativeRadioButtonGtk(radio_button); 299 return new NativeRadioButtonGtk(radio_button);
300 } 300 }
301 301
302 } // namespace views 302 } // namespace views
OLDNEW
« no previous file with comments | « views/animation/bounds_animator.cc ('k') | views/controls/button/radio_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698