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