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