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