]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/radiobut.h
Implement wxDocument::Revert() and show its use in the sample.
[wxWidgets.git] / interface / wx / radiobut.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobut.h
3 // Purpose: interface of wxRadioButton
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxRadioButton
11
12 A radio button item is a button which usually denotes one of several
13 mutually exclusive options. It has a text label next to a (usually) round
14 button.
15
16 You can create a group of mutually-exclusive radio buttons by specifying
17 @c wxRB_GROUP for the first in the group. The group ends when another
18 radio button group is created, or there are no more radio buttons.
19
20 @beginStyleTable
21 @style{wxRB_GROUP}
22 Marks the beginning of a new group of radio buttons.
23 @style{wxRB_SINGLE}
24 In some circumstances, radio buttons that are not consecutive
25 siblings trigger a hang bug in Windows (only). If this happens, add
26 this style to mark the button as not belonging to a group, and
27 implement the mutually-exclusive group behaviour yourself.
28 @style{wxRB_USE_CHECKBOX}
29 Use a checkbox button instead of radio button (currently supported
30 only on PalmOS).
31 @endStyleTable
32
33 @beginEventEmissionTable{wxCommandEvent}
34 @event{EVT_RADIOBUTTON(id, func)}
35 Process a @c wxEVT_COMMAND_RADIOBUTTON_SELECTED event, when the
36 radiobutton is clicked.
37 @endEventTable
38
39 @library{wxcore}
40 @category{ctrl}
41 @appearance{radiobutton.png}
42
43 @see @ref overview_events, wxRadioBox, wxCheckBox
44 */
45 class wxRadioButton : public wxControl
46 {
47 public:
48 /**
49 Default constructor.
50
51 @see Create(), wxValidator
52 */
53 wxRadioButton();
54
55 /**
56 Constructor, creating and showing a radio button.
57
58 @param parent
59 Parent window. Must not be @NULL.
60 @param id
61 Window identifier. The value @c wxID_ANY indicates a default value.
62 @param label
63 Label for the radio button.
64 @param pos
65 Window position. If ::wxDefaultPosition is specified then a default
66 position is chosen.
67 @param size
68 Window size. If ::wxDefaultSize is specified then a default size
69 is chosen.
70 @param style
71 Window style. See wxRadioButton.
72 @param validator
73 Window validator.
74 @param name
75 Window name.
76
77 @see Create(), wxValidator
78 */
79 wxRadioButton(wxWindow* parent, wxWindowID id,
80 const wxString& label,
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize,
83 long style = 0,
84 const wxValidator& validator = wxDefaultValidator,
85 const wxString& name = wxRadioButtonNameStr);
86
87 /**
88 Destructor, destroying the radio button item.
89 */
90 virtual ~wxRadioButton();
91
92 /**
93 Creates the choice for two-step construction. See wxRadioButton() for
94 further details.
95 */
96 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
97 const wxPoint& pos = wxDefaultPosition,
98 const wxSize& size = wxDefaultSize, long style = 0,
99 const wxValidator& validator = wxDefaultValidator,
100 const wxString& name = wxRadioButtonNameStr);
101
102 /**
103 Returns @true if the radio button is depressed, @false otherwise.
104 */
105 virtual bool GetValue() const;
106
107 /**
108 Sets the radio button to selected or deselected status. This does not cause a
109 @c wxEVT_COMMAND_RADIOBUTTON_SELECTED event to get emitted.
110
111 @param value
112 @true to select, @false to deselect.
113 */
114 virtual void SetValue(bool value);
115 };
116