]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: radiobut.h | |
e54c96f1 | 3 | // Purpose: interface of wxRadioButton |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxRadioButton | |
11 | @wxheader{radiobut.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | A radio button item is a button which usually denotes one of several mutually |
14 | exclusive options. It has a text label next to a (usually) round button. | |
7c913512 | 15 | |
23324ae1 FM |
16 | You can create a group of mutually-exclusive radio buttons by specifying @c |
17 | wxRB_GROUP for | |
18 | the first in the group. The group ends when another radio button group is | |
19 | created, or there are no more radio buttons. | |
7c913512 | 20 | |
23324ae1 | 21 | @beginStyleTable |
8c6791e4 | 22 | @style{wxRB_GROUP} |
23324ae1 | 23 | Marks the beginning of a new group of radio buttons. |
8c6791e4 | 24 | @style{wxRB_SINGLE} |
23324ae1 FM |
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. | |
8c6791e4 | 29 | @style{wxRB_USE_CHECKBOX} |
23324ae1 FM |
30 | Use a checkbox button instead of radio button (currently supported |
31 | only on PalmOS). | |
32 | @endStyleTable | |
7c913512 | 33 | |
1f1d2182 | 34 | @beginEventTable{wxCommandEvent} |
8c6791e4 | 35 | @event{EVT_RADIOBUTTON(id, func)} |
23324ae1 FM |
36 | Process a wxEVT_COMMAND_RADIOBUTTON_SELECTED event, when the |
37 | radiobutton is clicked. | |
38 | @endEventTable | |
7c913512 | 39 | |
23324ae1 FM |
40 | @library{wxcore} |
41 | @category{ctrl} | |
42 | @appearance{radiobutton.png} | |
7c913512 | 43 | |
1f1d2182 | 44 | @see @ref overview_eventhandling, wxRadioBox, wxCheckBox |
23324ae1 FM |
45 | */ |
46 | class wxRadioButton : public wxControl | |
47 | { | |
48 | public: | |
49 | //@{ | |
50 | /** | |
51 | Constructor, creating and showing a radio button. | |
3c4f71cc | 52 | |
7c913512 | 53 | @param parent |
4cc4bfaf | 54 | Parent window. Must not be @NULL. |
7c913512 | 55 | @param id |
4cc4bfaf | 56 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 57 | @param label |
4cc4bfaf | 58 | Label for the radio button. |
7c913512 | 59 | @param pos |
4cc4bfaf FM |
60 | Window position. If wxDefaultPosition is specified then a default |
61 | position is chosen. | |
7c913512 | 62 | @param size |
4cc4bfaf FM |
63 | Window size. If wxDefaultSize is specified then a default size |
64 | is chosen. | |
7c913512 | 65 | @param style |
4cc4bfaf | 66 | Window style. See wxRadioButton. |
7c913512 | 67 | @param validator |
4cc4bfaf | 68 | Window validator. |
7c913512 | 69 | @param name |
4cc4bfaf | 70 | Window name. |
3c4f71cc | 71 | |
4cc4bfaf | 72 | @see Create(), wxValidator |
23324ae1 FM |
73 | */ |
74 | wxRadioButton(); | |
7c913512 FM |
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 = "radioButton"); | |
23324ae1 FM |
82 | //@} |
83 | ||
84 | /** | |
85 | Destructor, destroying the radio button item. | |
86 | */ | |
87 | ~wxRadioButton(); | |
88 | ||
89 | /** | |
90 | Creates the choice for two-step construction. See wxRadioButton() for | |
91 | further details. | |
92 | */ | |
93 | bool Create(wxWindow* parent, wxWindowID id, | |
94 | const wxString& label, | |
95 | const wxPoint& pos = wxDefaultPosition, | |
96 | const wxSize& size = wxDefaultSize, | |
97 | long style = 0, | |
98 | const wxValidator& validator = wxDefaultValidator, | |
99 | const wxString& name = "radioButton"); | |
100 | ||
101 | /** | |
102 | Returns @true if the radio button is depressed, @false otherwise. | |
103 | */ | |
328f5751 | 104 | bool GetValue() const; |
23324ae1 FM |
105 | |
106 | /** | |
107 | Sets the radio button to selected or deselected status. This does not cause a | |
108 | wxEVT_COMMAND_RADIOBUTTON_SELECTED event to get emitted. | |
3c4f71cc | 109 | |
7c913512 | 110 | @param value |
4cc4bfaf | 111 | @true to select, @false to deselect. |
23324ae1 FM |
112 | */ |
113 | void SetValue(const bool value); | |
114 | }; | |
e54c96f1 | 115 |