From 0e6fe11ed699d693198e928723fc4afb13bba729 Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Wed, 25 Mar 2009 18:27:26 +0000 Subject: The native button's visible and enabled state were not working. BUG=9261 TEST=See bug. Review URL: http://codereview.chromium.org/42582 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12473 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/views/controls/button/native_button.cc | 7 +++++++ chrome/views/controls/button/native_button.h | 1 + chrome/views/controls/button/native_button_win.cc | 4 ++++ chrome/views/controls/button/native_button_win.h | 1 + chrome/views/controls/button/native_button_wrapper.h | 4 ++++ 5 files changed, 17 insertions(+) (limited to 'chrome') diff --git a/chrome/views/controls/button/native_button.cc b/chrome/views/controls/button/native_button.cc index f8c7c5d..a8c9c53 100644 --- a/chrome/views/controls/button/native_button.cc +++ b/chrome/views/controls/button/native_button.cc @@ -118,6 +118,12 @@ void NativeButton::Layout() { } } +void NativeButton::SetEnabled(bool flag) { + Button::SetEnabled(flag); + if (native_wrapper_) + native_wrapper_->UpdateEnabled(); +} + void NativeButton::ViewHierarchyChanged(bool is_add, View* parent, View* child) { if (is_add && !native_wrapper_ && GetWidget()) { @@ -151,6 +157,7 @@ void NativeButton::Focus() { void NativeButton::CreateWrapper() { native_wrapper_ = NativeButtonWrapper::CreateNativeButtonWrapper(this); native_wrapper_->UpdateLabel(); + native_wrapper_->UpdateEnabled(); } void NativeButton::InitBorder() { diff --git a/chrome/views/controls/button/native_button.h b/chrome/views/controls/button/native_button.h index ccbf125..e86e80c 100644 --- a/chrome/views/controls/button/native_button.h +++ b/chrome/views/controls/button/native_button.h @@ -48,6 +48,7 @@ class NativeButton : public Button { // Overridden from View: virtual gfx::Size GetPreferredSize(); virtual void Layout(); + virtual void SetEnabled(bool flag); virtual void Focus(); protected: diff --git a/chrome/views/controls/button/native_button_win.cc b/chrome/views/controls/button/native_button_win.cc index e044c75..64f9f34 100644 --- a/chrome/views/controls/button/native_button_win.cc +++ b/chrome/views/controls/button/native_button_win.cc @@ -40,6 +40,10 @@ void NativeButtonWin::UpdateFont() { FALSE); } +void NativeButtonWin::UpdateEnabled() { + SetEnabled(native_button_->IsEnabled()); +} + void NativeButtonWin::UpdateDefault() { if (!IsCheckbox()) { SendMessage(GetHWND(), BM_SETSTYLE, diff --git a/chrome/views/controls/button/native_button_win.h b/chrome/views/controls/button/native_button_win.h index 4bb0065..42dcbec 100644 --- a/chrome/views/controls/button/native_button_win.h +++ b/chrome/views/controls/button/native_button_win.h @@ -20,6 +20,7 @@ class NativeButtonWin : public NativeControlWin, // Overridden from NativeButtonWrapper: virtual void UpdateLabel(); virtual void UpdateFont(); + virtual void UpdateEnabled(); virtual void UpdateDefault(); virtual View* GetView(); virtual void SetFocus(); diff --git a/chrome/views/controls/button/native_button_wrapper.h b/chrome/views/controls/button/native_button_wrapper.h index 95ad634..475166e 100644 --- a/chrome/views/controls/button/native_button_wrapper.h +++ b/chrome/views/controls/button/native_button_wrapper.h @@ -24,6 +24,10 @@ class NativeButtonWrapper { // associated NativeButton. virtual void UpdateFont() = 0; + // Updates the native button's enabled state from the state stored in its + // associated NativeButton. + virtual void UpdateEnabled() = 0; + // Updates the native button's default state from the state stored in its // associated NativeButton. virtual void UpdateDefault() = 0; -- cgit v1.1