summaryrefslogtreecommitdiffstats
path: root/chrome/views/controls/button/radio_button.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 21:55:52 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 21:55:52 +0000
commita8111ce7343d3d6458eff4a5f370cf611f6753b4 (patch)
tree30dfb0171c2e450f0271d3c787ac0cfbc06e663b /chrome/views/controls/button/radio_button.h
parente48211e18675bec9056fb0762ec1c6644b0ff32e (diff)
downloadchromium_src-a8111ce7343d3d6458eff4a5f370cf611f6753b4.zip
chromium_src-a8111ce7343d3d6458eff4a5f370cf611f6753b4.tar.gz
chromium_src-a8111ce7343d3d6458eff4a5f370cf611f6753b4.tar.bz2
The death knell for the old native buttons, checkboxes and radio buttons.
Replace with renamed NativeButton2, Checkbox2, RadioButton2. Review URL: http://codereview.chromium.org/50083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12317 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/controls/button/radio_button.h')
-rw-r--r--chrome/views/controls/button/radio_button.h54
1 files changed, 18 insertions, 36 deletions
diff --git a/chrome/views/controls/button/radio_button.h b/chrome/views/controls/button/radio_button.h
index dbae232..f1db45b 100644
--- a/chrome/views/controls/button/radio_button.h
+++ b/chrome/views/controls/button/radio_button.h
@@ -1,6 +1,6 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
#ifndef CHROME_VIEWS_CONTROLS_BUTTON_RADIO_BUTTON_H_
#define CHROME_VIEWS_CONTROLS_BUTTON_RADIO_BUTTON_H_
@@ -9,52 +9,34 @@
namespace views {
-////////////////////////////////////////////////////////////////////////////////
-//
-// A wrapper for windows's native radio button. Radio buttons can be mutually
-// exclusive with other radio buttons.
-//
-////////////////////////////////////////////////////////////////////////////////
-class RadioButton : public CheckBox {
+// A Checkbox subclass representing a radio button.
+class RadioButton : public Checkbox {
public:
- // The view class name.
+ // The button's class name.
static const char kViewClassName[];
- // Create a radio button with the provided label and group id.
- // The group id is used to identify all the other radio buttons which are in
- // mutual exclusion with this radio button. Note: RadioButton assumes that
- // all views with that group id are RadioButton. It is an error to give
- // that group id to another view subclass which is not a radio button or
- // a radio button subclass.
+ RadioButton();
+ RadioButton(const std::wstring& label);
RadioButton(const std::wstring& label, int group_id);
virtual ~RadioButton();
- virtual gfx::Size GetPreferredSize();
- virtual void Layout();
-
- virtual std::string GetClassName() const;
-
- // Overridden to properly perform mutual exclusion.
- virtual void SetIsSelected(bool f);
+ // Overridden from Checkbox:
+ virtual void SetChecked(bool checked);
+ // Overridden from View:
virtual View* GetSelectedViewForGroup(int group_id);
-
- // When focusing a RadioButton with Tab/Shift-Tab, only the selected button
- // from the group should be accessible.
- virtual bool IsGroupFocusTraversable() const { return false; }
+ virtual bool IsGroupFocusTraversable() const;
protected:
- virtual HWND CreateNativeControl(HWND parent_container);
- virtual LRESULT OnCommand(UINT code, int id, HWND source);
+ virtual std::string GetClassName() const;
- private:
- // Get the horizontal distance of the start of the text from the left of the
- // control.
- static int GetTextIndent();
+ // Overridden from NativeButton:
+ virtual void CreateWrapper();
- DISALLOW_EVIL_CONSTRUCTORS(RadioButton);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RadioButton);
};
} // namespace views
-#endif // CHROME_VIEWS_CONTROLS_BUTTON_RADIO_BUTTON_H_
+#endif // #ifndef CHROME_VIEWS_CONTROLS_BUTTON_RADIO_BUTTON_H_