diff options
5 files changed, 17 insertions, 0 deletions
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; |