]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxCheckBox}}\label{wxcheckbox} |
2 | ||
c0d26c0f VS |
3 | A checkbox is a labelled box which by default is either on (checkmark is |
4 | visible) or off (no checkmark). Optionally (When the wxCHK\_3STATE style flag | |
5 | is set) it can have a third state, called the mixed or undetermined state. | |
6 | Often this is used as a "Does Not Apply" state. | |
a660d684 KB |
7 | |
8 | \wxheading{Derived from} | |
9 | ||
10 | \helpref{wxControl}{wxcontrol}\\ | |
11 | \helpref{wxWindow}{wxwindow}\\ | |
12 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
13 | \helpref{wxObject}{wxobject} | |
14 | ||
954b8ae6 JS |
15 | \wxheading{Include files} |
16 | ||
17 | <wx/checkbox.h> | |
18 | ||
a660d684 KB |
19 | \wxheading{Window styles} |
20 | ||
8941fa88 | 21 | \twocolwidtha{7cm} |
bffd3bf9 | 22 | \begin{twocollist}\itemsep=0pt |
0032ddbb | 23 | \twocolitem{\windowstyle{wxCHK\_2STATE}}{Create a 2-state checkbox. This is the default.} |
8941fa88 VZ |
24 | \twocolitem{\windowstyle{wxCHK\_3STATE}}{Create a 3-state checkbox.} |
25 | \twocolitem{\windowstyle{wxCHK\_ALLOW\_3RD\_STATE\_FOR\_USER}}{By default a user can't set a 3-state checkbox | |
26 | to the third state. It can only be done from code. Using this flags allows the user to set the checkbox to the third state by clicking. } | |
bffd3bf9 MB |
27 | \twocolitem{\windowstyle{wxALIGN\_RIGHT}}{Makes the text appear on the left of the checkbox.} |
28 | \end{twocollist} | |
a660d684 KB |
29 | |
30 | See also \helpref{window styles overview}{windowstyles}. | |
31 | ||
5de76427 JS |
32 | \wxheading{Event handling} |
33 | ||
34 | \twocolwidtha{7cm} | |
35 | \begin{twocollist}\itemsep=0pt | |
36 | \twocolitem{{\bf EVT\_CHECKBOX(id, func)}}{Process a wxEVT\_COMMAND\_CHECKBOX\_CLICKED event, | |
37 | when the checkbox is clicked.} | |
38 | \end{twocollist} | |
39 | ||
a660d684 KB |
40 | \wxheading{See also} |
41 | ||
5de76427 | 42 | \helpref{wxRadioButton}{wxradiobutton}, \helpref{wxCommandEvent}{wxcommandevent} |
a660d684 KB |
43 | |
44 | \latexignore{\rtfignore{\wxheading{Members}}} | |
45 | ||
46 | \membersection{wxCheckBox::wxCheckBox}\label{wxcheckboxconstr} | |
47 | ||
48 | \func{}{wxCheckBox}{\void} | |
49 | ||
50 | Default constructor. | |
51 | ||
eaaa6a06 | 52 | \func{}{wxCheckBox}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 KB |
53 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp |
54 | \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
55 | \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}} | |
56 | ||
57 | Constructor, creating and showing a checkbox. | |
58 | ||
59 | \wxheading{Parameters} | |
60 | ||
61 | \docparam{parent}{Parent window. Must not be NULL.} | |
62 | ||
63 | \docparam{id}{Checkbox identifier. A value of -1 indicates a default value.} | |
64 | ||
65 | \docparam{label}{Text to be displayed next to the checkbox.} | |
66 | ||
67 | \docparam{pos}{Checkbox position. If the position (-1, -1) is specified then a default position is chosen.} | |
68 | ||
69 | \docparam{size}{Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.} | |
70 | ||
71 | \docparam{style}{Window style. See \helpref{wxCheckBox}{wxcheckbox}.} | |
72 | ||
73 | \docparam{validator}{Window validator.} | |
74 | ||
75 | \docparam{name}{Window name.} | |
76 | ||
77 | \wxheading{See also} | |
78 | ||
79 | \helpref{wxCheckBox::Create}{wxcheckboxcreate}, \helpref{wxValidator}{wxvalidator} | |
80 | ||
81 | \membersection{wxCheckBox::\destruct{wxCheckBox}} | |
82 | ||
83 | \func{}{\destruct{wxCheckBox}}{\void} | |
84 | ||
85 | Destructor, destroying the checkbox. | |
86 | ||
87 | \membersection{wxCheckBox::Create}\label{wxcheckboxcreate} | |
88 | ||
eaaa6a06 | 89 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 KB |
90 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp |
91 | \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
92 | \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}} | |
93 | ||
94 | Creates the checkbox for two-step construction. See \helpref{wxCheckBox::wxCheckBox}{wxcheckboxconstr}\rtfsp | |
95 | for details. | |
96 | ||
97 | \membersection{wxCheckBox::GetValue}\label{wxcheckboxgetvalue} | |
98 | ||
99 | \constfunc{bool}{GetValue}{\void} | |
100 | ||
8941fa88 VZ |
101 | Gets the state of a 2-state checkbox. |
102 | ||
103 | \wxheading{Return value} | |
104 | ||
105 | Returns \true if it is checked, \false otherwise. | |
106 | ||
107 | \membersection{wxCheckBox::Get3StateValue}\label{wxcheckboxgetthreestatevalue} | |
108 | ||
109 | \constfunc{wxCheckBoxState}{Get3StateValue}{\void} | |
110 | ||
111 | Gets the state of a 3-state checkbox. | |
112 | ||
113 | \wxheading{Return value} | |
114 | ||
115 | Returns wxCHK\_UNCHECKED when the checkbox is unchecked, wxCHK\_CHECKED | |
116 | when it is checked and wxCHK\_UNDETERMINED when it's in the undetermined | |
117 | state. Asserts when the function is used with a 2-state checkbox. | |
118 | ||
119 | \membersection{wxCheckBox::Is3rdStateAllowedForUser}\label{wxcheckboxis3rdstateallowedforuser} | |
120 | ||
121 | \constfunc{bool}{Is3rdStateAllowedForUser}{\void} | |
122 | ||
123 | Returns whether or not the user can set the checkbox to the third state. | |
a660d684 KB |
124 | |
125 | \wxheading{Return value} | |
126 | ||
8941fa88 VZ |
127 | Returns \true if the user can set the third state of this checkbox, \false if it can only be set |
128 | programmatically or if it's a 2-state checkbox. | |
129 | ||
130 | \membersection{wxCheckBox::Is3State}\label{wxcheckboxis3state} | |
131 | ||
132 | \constfunc{bool}{Is3State}{\void} | |
133 | ||
134 | Returns whether or not the checkbox is a 3-state checkbox. | |
135 | ||
136 | \wxheading{Return value} | |
137 | ||
138 | Returns \true if this checkbox is a 3-state checkbox, \false if it's a 2-state checkbox. | |
6e8e9b66 VZ |
139 | |
140 | \membersection{wxCheckBox::IsChecked}\label{wxcheckboxischecked} | |
141 | ||
142 | \constfunc{bool}{IsChecked}{\void} | |
143 | ||
144 | This is just a maybe more readable synonym for | |
145 | \helpref{GetValue}{wxcheckboxgetvalue}: just as the latter, it returns | |
8941fa88 | 146 | \true if the checkbox is checked and \false otherwise. |
a660d684 KB |
147 | |
148 | \membersection{wxCheckBox::SetValue}\label{wxcheckboxsetvalue} | |
149 | ||
0da52ad1 | 150 | \func{void}{SetValue}{\param{bool}{ state}} |
a660d684 | 151 | |
953704c1 RR |
152 | Sets the checkbox to the given state. This does not cause a |
153 | wxEVT\_COMMAND\_CHECKBOX\_CLICKED event to get emitted. | |
a660d684 KB |
154 | |
155 | \wxheading{Parameters} | |
156 | ||
8941fa88 VZ |
157 | \docparam{state}{If \true, the check is on, otherwise it is off.} |
158 | ||
159 | \membersection{wxCheckBox::Set3StateValue}\label{wxcheckboxset3statevalue} | |
160 | ||
161 | \func{void}{Set3StateValue}{\param{const wxCheckBoxState}{ state}} | |
162 | ||
163 | Sets the checkbox to the given state. This does not cause a | |
164 | wxEVT\_COMMAND\_CHECKBOX\_CLICKED event to get emitted. | |
165 | ||
166 | \wxheading{Parameters} | |
a660d684 | 167 | |
8941fa88 VZ |
168 | \docparam{state}{Can be one of: wxCHK\_UNCHECKED (Check is off), wxCHK\_CHECKED |
169 | (Check is on) or wxCHK\_UNDETERMINED (Check is mixed). Asserts when the checkbox | |
170 | is a 2-state checkbox and setting the state to wxCHK\_UNDETERMINED.} |