]>
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 | |
3ed3a1c8 BP |
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. | |
7c913512 | 16 | |
3ed3a1c8 BP |
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. | |
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)} |
3ed3a1c8 | 36 | Process a @c wxEVT_COMMAND_RADIOBUTTON_SELECTED event, when the |
23324ae1 FM |
37 | radiobutton is clicked. |
38 | @endEventTable | |
7c913512 | 39 | |
23324ae1 FM |
40 | @library{wxcore} |
41 | @category{ctrl} | |
0c7fe6f2 | 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: | |
3ed3a1c8 BP |
49 | |
50 | /** | |
51 | Default constructor. | |
52 | ||
53 | @see Create(), wxValidator | |
54 | */ | |
55 | wxRadioButton(); | |
56 | ||
23324ae1 FM |
57 | /** |
58 | Constructor, creating and showing a radio button. | |
3c4f71cc | 59 | |
7c913512 | 60 | @param parent |
4cc4bfaf | 61 | Parent window. Must not be @NULL. |
7c913512 | 62 | @param id |
3ed3a1c8 | 63 | Window identifier. The value @c wxID_ANY indicates a default value. |
7c913512 | 64 | @param label |
4cc4bfaf | 65 | Label for the radio button. |
7c913512 | 66 | @param pos |
3ed3a1c8 | 67 | Window position. If @c wxDefaultPosition is specified then a default |
4cc4bfaf | 68 | position is chosen. |
7c913512 | 69 | @param size |
3ed3a1c8 | 70 | Window size. If @c wxDefaultSize is specified then a default size |
4cc4bfaf | 71 | is chosen. |
7c913512 | 72 | @param style |
4cc4bfaf | 73 | Window style. See wxRadioButton. |
7c913512 | 74 | @param validator |
4cc4bfaf | 75 | Window validator. |
7c913512 | 76 | @param name |
4cc4bfaf | 77 | Window name. |
3c4f71cc | 78 | |
4cc4bfaf | 79 | @see Create(), wxValidator |
23324ae1 | 80 | */ |
7c913512 FM |
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"); | |
23324ae1 FM |
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 | */ | |
328f5751 | 109 | bool GetValue() const; |
23324ae1 FM |
110 | |
111 | /** | |
112 | Sets the radio button to selected or deselected status. This does not cause a | |
3ed3a1c8 | 113 | @c wxEVT_COMMAND_RADIOBUTTON_SELECTED event to get emitted. |
3c4f71cc | 114 | |
7c913512 | 115 | @param value |
4cc4bfaf | 116 | @true to select, @false to deselect. |
23324ae1 FM |
117 | */ |
118 | void SetValue(const bool value); | |
119 | }; | |
e54c96f1 | 120 |