]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: radiobut.h | |
e54c96f1 | 3 | // Purpose: interface of wxRadioButton |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxRadioButton | |
7c913512 | 10 | |
3ed3a1c8 BP |
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. | |
7c913512 | 14 | |
3ed3a1c8 BP |
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. | |
7c913512 | 18 | |
23324ae1 | 19 | @beginStyleTable |
8c6791e4 | 20 | @style{wxRB_GROUP} |
23324ae1 | 21 | Marks the beginning of a new group of radio buttons. |
8c6791e4 | 22 | @style{wxRB_SINGLE} |
23324ae1 FM |
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. | |
23324ae1 | 27 | @endStyleTable |
7c913512 | 28 | |
3051a44a | 29 | @beginEventEmissionTable{wxCommandEvent} |
8c6791e4 | 30 | @event{EVT_RADIOBUTTON(id, func)} |
ce7fe42e | 31 | Process a @c wxEVT_RADIOBUTTON event, when the |
23324ae1 FM |
32 | radiobutton is clicked. |
33 | @endEventTable | |
7c913512 | 34 | |
23324ae1 FM |
35 | @library{wxcore} |
36 | @category{ctrl} | |
ce154616 | 37 | @appearance{radiobutton} |
7c913512 | 38 | |
830b7aa7 | 39 | @see @ref overview_events, wxRadioBox, wxCheckBox |
23324ae1 FM |
40 | */ |
41 | class wxRadioButton : public wxControl | |
42 | { | |
43 | public: | |
3ed3a1c8 BP |
44 | /** |
45 | Default constructor. | |
46 | ||
47 | @see Create(), wxValidator | |
48 | */ | |
49 | wxRadioButton(); | |
50 | ||
23324ae1 FM |
51 | /** |
52 | Constructor, creating and showing a radio button. | |
3c4f71cc | 53 | |
7c913512 | 54 | @param parent |
4cc4bfaf | 55 | Parent window. Must not be @NULL. |
7c913512 | 56 | @param id |
3ed3a1c8 | 57 | Window identifier. The value @c wxID_ANY indicates a default value. |
7c913512 | 58 | @param label |
4cc4bfaf | 59 | Label for the radio button. |
7c913512 | 60 | @param pos |
76e2b570 FM |
61 | Window position. If ::wxDefaultPosition is specified then a default |
62 | position is chosen. | |
7c913512 | 63 | @param size |
76e2b570 FM |
64 | Window size. If ::wxDefaultSize is specified then a default size |
65 | is chosen. | |
7c913512 | 66 | @param style |
4cc4bfaf | 67 | Window style. See wxRadioButton. |
7c913512 | 68 | @param validator |
4cc4bfaf | 69 | Window validator. |
7c913512 | 70 | @param name |
4cc4bfaf | 71 | Window name. |
3c4f71cc | 72 | |
4cc4bfaf | 73 | @see Create(), wxValidator |
23324ae1 | 74 | */ |
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, | |
11e3af6e | 81 | const wxString& name = wxRadioButtonNameStr); |
23324ae1 FM |
82 | |
83 | /** | |
84 | Destructor, destroying the radio button item. | |
85 | */ | |
adaaa686 | 86 | virtual ~wxRadioButton(); |
23324ae1 FM |
87 | |
88 | /** | |
89 | Creates the choice for two-step construction. See wxRadioButton() for | |
90 | further details. | |
91 | */ | |
43c48e1e | 92 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, |
23324ae1 | 93 | const wxPoint& pos = wxDefaultPosition, |
43c48e1e | 94 | const wxSize& size = wxDefaultSize, long style = 0, |
23324ae1 | 95 | const wxValidator& validator = wxDefaultValidator, |
43c48e1e | 96 | const wxString& name = wxRadioButtonNameStr); |
23324ae1 FM |
97 | |
98 | /** | |
24a03ec5 | 99 | Returns @true if the radio button is checked, @false otherwise. |
23324ae1 | 100 | */ |
adaaa686 | 101 | virtual bool GetValue() const; |
23324ae1 FM |
102 | |
103 | /** | |
24a03ec5 | 104 | Sets the radio button to checked or unchecked status. This does not cause a |
ce7fe42e | 105 | @c wxEVT_RADIOBUTTON event to get emitted. |
24a03ec5 VZ |
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. | |
3c4f71cc | 111 | |
7c913512 | 112 | @param value |
24a03ec5 | 113 | @true to check, @false to uncheck. |
23324ae1 | 114 | */ |
43c48e1e | 115 | virtual void SetValue(bool value); |
23324ae1 | 116 | }; |
e54c96f1 | 117 |