diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 18:48:44 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 18:48:44 +0000 |
commit | b2b26af9cd8e5d436fdf27d2f266ad3c23f7a192 (patch) | |
tree | e6044f1f9197ffaf6c0ef908bc73400b4274a240 /chrome/views | |
parent | 80cc3f70e67f5a2efeb0f434c58d9f9b5641f21a (diff) | |
download | chromium_src-b2b26af9cd8e5d436fdf27d2f266ad3c23f7a192.zip chromium_src-b2b26af9cd8e5d436fdf27d2f266ad3c23f7a192.tar.gz chromium_src-b2b26af9cd8e5d436fdf27d2f266ad3c23f7a192.tar.bz2 |
Fix a bug where radio buttons would become unselected when clicked (more specifically, when clicked on the button, not the label).
BUG=10834
TEST=Open the option dialog, click on the button (not the label) of a selected radio-button. The button should stay selected. Make sure checkboxes and radio buttons still behave as expected.
Review URL: http://codereview.chromium.org/97012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/controls/button/native_button_win.cc | 3 | ||||
-rw-r--r-- | chrome/views/controls/button/native_button_win.h | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/chrome/views/controls/button/native_button_win.cc b/chrome/views/controls/button/native_button_win.cc index a6cf075..5a254ac 100644 --- a/chrome/views/controls/button/native_button_win.cc +++ b/chrome/views/controls/button/native_button_win.cc @@ -160,7 +160,8 @@ bool NativeCheckboxWin::OnKeyDown(int vkey) { bool NativeCheckboxWin::ProcessMessage(UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { if (message == WM_COMMAND && HIWORD(w_param) == BN_CLICKED) { - checkbox_->SetChecked(!checkbox_->checked()); + if (!IsRadioButton() || !checkbox_->checked()) + checkbox_->SetChecked(!checkbox_->checked()); // Fall through to the NativeButtonWin's handler, which will send the // clicked notification to the listener... } diff --git a/chrome/views/controls/button/native_button_win.h b/chrome/views/controls/button/native_button_win.h index f9dbcaf..ce1cc75e 100644 --- a/chrome/views/controls/button/native_button_win.h +++ b/chrome/views/controls/button/native_button_win.h @@ -75,6 +75,9 @@ class NativeCheckboxWin : public NativeButtonWin { virtual void NativeControlCreated(HWND control_hwnd); virtual bool IsCheckbox() const { return true; } + // Returns true if this button is actually a radio button. + virtual bool IsRadioButton() const { return false; } + private: // The Checkbox we are bound to. Checkbox* checkbox_; @@ -91,6 +94,7 @@ class NativeRadioButtonWin : public NativeCheckboxWin { protected: // Overridden from NativeCheckboxWin: virtual void CreateNativeControl(); + virtual bool IsRadioButton() const { return true; } private: DISALLOW_COPY_AND_ASSIGN(NativeRadioButtonWin); |