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

Side by Side Diff: views/controls/native_control_gtk.cc

Issue 6976048: views: Add OnEnabledChanged() method to View class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix DisableOnHover test? Created 9 years, 6 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/controls/native_control_gtk.h ('k') | views/controls/native_control_win.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) 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/native_control_gtk.h" 5 #include "views/controls/native_control_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/accessibility/accessibility_types.h" 10 #include "ui/base/accessibility/accessibility_types.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 NativeControlGtk::~NativeControlGtk() { 146 NativeControlGtk::~NativeControlGtk() {
147 if (native_view()) 147 if (native_view())
148 gtk_widget_destroy(native_view()); 148 gtk_widget_destroy(native_view());
149 } 149 }
150 150
151 //////////////////////////////////////////////////////////////////////////////// 151 ////////////////////////////////////////////////////////////////////////////////
152 // NativeControlGtk, View overrides: 152 // NativeControlGtk, View overrides:
153 153
154 void NativeControlGtk::SetEnabled(bool enabled) { 154 void NativeControlGtk::OnEnabledChanged() {
155 if (IsEnabled() != enabled) { 155 View::OnEnabledChanged();
156 View::SetEnabled(enabled); 156 if (native_view())
157 if (native_view()) 157 gtk_widget_set_sensitive(native_view(), IsEnabled());
158 gtk_widget_set_sensitive(native_view(), IsEnabled());
159 }
160 } 158 }
161 159
162 void NativeControlGtk::ViewHierarchyChanged(bool is_add, View* parent, 160 void NativeControlGtk::ViewHierarchyChanged(bool is_add, View* parent,
163 View* child) { 161 View* child) {
164 // Call the base class to hide the view if we're being removed. 162 // Call the base class to hide the view if we're being removed.
165 NativeViewHost::ViewHierarchyChanged(is_add, parent, child); 163 NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
166 164
167 if (!is_add && child == this && native_view()) { 165 if (!is_add && child == this && native_view()) {
168 Detach(); 166 Detach();
169 } else if (is_add && GetWidget() && !native_view()) { 167 } else if (is_add && GetWidget() && !native_view()) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // options page is only based on views. 242 // options page is only based on views.
245 // NOTREACHED(); 243 // NOTREACHED();
246 NOTIMPLEMENTED(); 244 NOTIMPLEMENTED();
247 return false; 245 return false;
248 } 246 }
249 focus_manager->SetFocusedView(control->focus_view()); 247 focus_manager->SetFocusedView(control->focus_view());
250 return false; 248 return false;
251 } 249 }
252 250
253 } // namespace views 251 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/native_control_gtk.h ('k') | views/controls/native_control_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698