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