summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 18:27:26 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 18:27:26 +0000
commit0e6fe11ed699d693198e928723fc4afb13bba729 (patch)
tree156041a3c251bd783937bcfe2d446851449cc3c6 /chrome/views
parent9482c3957d95797f4e4438bdb1c175449116a256 (diff)
downloadchromium_src-0e6fe11ed699d693198e928723fc4afb13bba729.zip
chromium_src-0e6fe11ed699d693198e928723fc4afb13bba729.tar.gz
chromium_src-0e6fe11ed699d693198e928723fc4afb13bba729.tar.bz2
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
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/controls/button/native_button.cc7
-rw-r--r--chrome/views/controls/button/native_button.h1
-rw-r--r--chrome/views/controls/button/native_button_win.cc4
-rw-r--r--chrome/views/controls/button/native_button_win.h1
-rw-r--r--chrome/views/controls/button/native_button_wrapper.h4
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;