]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/radiobut.h
don't use invalid item indices in wxLC_HRULES-drawing code (closes #10484)
[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 @beginEventTable{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_eventhandling, wxRadioBox, wxCheckBox
44 */
45 class wxRadioButton : public wxControl
46 {
47 public:
48
49 /**
50 Default constructor.
51
52 @see Create(), wxValidator
53 */
54 wxRadioButton();
55
56 /**
57 Constructor, creating and showing a radio button.
58
59 @param parent
60 Parent window. Must not be @NULL.
61 @param id
62 Window identifier. The value @c wxID_ANY indicates a default value.
63 @param label
64 Label for the radio button.
65 @param pos
66 Window position. If @c wxDefaultPosition is specified then a default
67 position is chosen.
68 @param size
69 Window size. If @c wxDefaultSize is specified then a default size
70 is chosen.
71 @param style
72 Window style. See wxRadioButton.
73 @param validator
74 Window validator.
75 @param name
76 Window name.
77
78 @see Create(), wxValidator
79 */
80 wxRadioButton(wxWindow* parent, wxWindowID id,
81 const wxString& label,
82 const wxPoint& pos = wxDefaultPosition,
83 const wxSize& size = wxDefaultSize,
84 long style = 0,
85 const wxValidator& validator = wxDefaultValidator,
86 const wxString& name = wxRadioButtonNameStr);
87
88 /**
89 Destructor, destroying the radio button item.
90 */
91 virtual ~wxRadioButton();
92
93 /**
94 Creates the choice for two-step construction. See wxRadioButton() for
95 further details.
96 */
97 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
98 const wxPoint& pos = wxDefaultPosition,
99 const wxSize& size = wxDefaultSize, long style = 0,
100 const wxValidator& validator = wxDefaultValidator,
101 const wxString& name = wxRadioButtonNameStr);
102
103 /**
104 Returns @true if the radio button is depressed, @false otherwise.
105 */
106 virtual bool GetValue() const;
107
108 /**
109 Sets the radio button to selected or deselected status. This does not cause a
110 @c wxEVT_COMMAND_RADIOBUTTON_SELECTED event to get emitted.
111
112 @param value
113 @true to select, @false to deselect.
114 */
115 virtual void SetValue(bool value);
116 };
117