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