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

Side by Side Diff: views/controls/native_control_win.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_win.h ('k') | views/controls/progress_bar.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) 2010 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_win.h" 5 #include "views/controls/native_control_win.h"
6 6
7 #include <windowsx.h> 7 #include <windowsx.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"
11 #include "ui/base/l10n/l10n_util_win.h" 11 #include "ui/base/l10n/l10n_util_win.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 *result = GetControlColor(message, reinterpret_cast<HDC>(w_param), 51 *result = GetControlColor(message, reinterpret_cast<HDC>(w_param),
52 native_view()); 52 native_view());
53 return true; 53 return true;
54 } 54 }
55 return false; 55 return false;
56 } 56 }
57 57
58 //////////////////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////////////////
59 // NativeControlWin, View overrides: 59 // NativeControlWin, View overrides:
60 60
61 void NativeControlWin::SetEnabled(bool enabled) { 61 void NativeControlWin::OnEnabledChanged() {
62 if (IsEnabled() != enabled) { 62 View::OnEnabledChanged();
63 View::SetEnabled(enabled); 63 if (native_view())
64 if (native_view()) 64 EnableWindow(native_view(), IsEnabled());
65 EnableWindow(native_view(), IsEnabled());
66 }
67 } 65 }
68 66
69 void NativeControlWin::ViewHierarchyChanged(bool is_add, View* parent, 67 void NativeControlWin::ViewHierarchyChanged(bool is_add, View* parent,
70 View* child) { 68 View* child) {
71 // Call the base class to hide the view if we're being removed. 69 // Call the base class to hide the view if we're being removed.
72 NativeViewHost::ViewHierarchyChanged(is_add, parent, child); 70 NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
73 71
74 // Create the HWND when we're added to a valid Widget. Many controls need a 72 // Create the HWND when we're added to a valid Widget. Many controls need a
75 // parent HWND to function properly. 73 // parent HWND to function properly.
76 if (is_add && GetWidget() && !native_view()) 74 if (is_add && GetWidget() && !native_view())
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } else if (message == WM_DESTROY) { 216 } else if (message == WM_DESTROY) {
219 native_control->props_.reset(); 217 native_control->props_.reset();
220 ui::SetWindowProc(window, native_control->original_wndproc_); 218 ui::SetWindowProc(window, native_control->original_wndproc_);
221 } 219 }
222 220
223 return CallWindowProc(native_control->original_wndproc_, window, message, 221 return CallWindowProc(native_control->original_wndproc_, window, message,
224 w_param, l_param); 222 w_param, l_param);
225 } 223 }
226 224
227 } // namespace views 225 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/native_control_win.h ('k') | views/controls/progress_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698