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

Unified Diff: views/controls/native_control.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, 7 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 | « views/controls/native_control.h ('k') | views/controls/native_control_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/native_control.cc
diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc
index 83a67e53a0eb24418b26ab629b3198991e303514..06878f41d37c8aebe511155cafdd7b50b50219df 100644
--- a/views/controls/native_control.cc
+++ b/views/controls/native_control.cc
@@ -13,8 +13,8 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "ui/base/accessibility/accessibility_types.h"
-#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/keycodes/keyboard_code_conversion_win.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/base/view_prop.h"
#include "ui/base/win/hwnd_util.h"
@@ -178,7 +178,6 @@ NativeControl::NativeControl() : hwnd_view_(NULL),
horizontal_alignment_(CENTER),
fixed_height_(-1),
vertical_alignment_(CENTER) {
- enabled_ = true;
focusable_ = true;
}
@@ -199,8 +198,8 @@ void NativeControl::ValidateNativeControl() {
container_ = new NativeControlContainer(this);
container_->Init();
hwnd_view_->Attach(*container_);
- if (!enabled_)
- EnableWindow(GetNativeControlHWND(), enabled_);
+ if (!IsEnabled())
+ EnableWindow(GetNativeControlHWND(), IsEnabled());
// This message ensures that the focus border is shown.
::SendMessage(container_->GetControl(),
@@ -312,13 +311,10 @@ void NativeControl::SetVisible(bool f) {
}
}
-void NativeControl::SetEnabled(bool enabled) {
- if (enabled_ != enabled) {
- View::SetEnabled(enabled);
- if (GetNativeControlHWND()) {
- EnableWindow(GetNativeControlHWND(), enabled_);
- }
- }
+void NativeControl::OnEnabledChanged() {
+ View::OnEnabledChanged();
+ if (GetNativeControlHWND())
+ EnableWindow(GetNativeControlHWND(), IsEnabled());
}
void NativeControl::OnPaint(gfx::Canvas* canvas) {
« no previous file with comments | « views/controls/native_control.h ('k') | views/controls/native_control_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698