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