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