]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/tglbtn.tex
MF_BYCOMMAND is zero so don't try to test it
[wxWidgets.git] / docs / latex / wx / tglbtn.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: tglbtn.tex
3 %% Purpose: wxToggleButton documentation
4 %% Author: Vadim Zeitlin
5 %% Modified by:
6 %% Created: 20.11.01
7 %% RCS-ID: $Id$
8 %% Copyright: (c) 2001 Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{\class{wxToggleButton}}\label{wxtogglebutton}
13
14 wxToggleButton is a button that stays pressed when clicked by the user. In
15 other words, it is similar to \helpref{wxCheckBox}{wxcheckbox} in
16 functionality but looks like a \helpref{wxButton}{wxbutton}.
17
18 You can see wxToggleButton in action in the sixth page of the
19 \helpref{controls}{samplecontrols} sample.
20
21 {\bf NB:} This class is not available under wxUniversal ports such
22 as wxX11.
23
24 \wxheading{Derived from}
25
26 \helpref{wxControl}{wxcontrol}\\
27 \helpref{wxWindow}{wxwindow}\\
28 \helpref{wxEvtHandler}{wxevthandler}\\
29 \helpref{wxObject}{wxobject}
30
31 \wxheading{Include files}
32
33 <wx/tglbtn.h>
34
35 \wxheading{Window styles}
36
37 There are no special styles for wxToggleButton.
38
39 See also \helpref{window styles overview}{windowstyles}.
40
41 \wxheading{Event handling}
42
43 \twocolwidtha{7cm}
44 \begin{twocollist}\itemsep=0pt
45 \twocolitem{{\bf EVT\_TOGGLEBUTTON(id, func)}}{Handles button click event.}
46 \end{twocollist}
47
48 \wxheading{See also}
49
50 \helpref{wxCheckBox}{wxcheckbox}, \helpref{wxButton}{wxbutton}
51
52 \latexignore{\rtfignore{\wxheading{Members}}}
53
54 \membersection{wxToggleButton::wxToggleButton}\label{wxtogglebuttonconstr}
55
56 \func{}{wxToggleButton}{\void}
57
58 Default constructor.
59
60 \func{}{wxToggleButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
61 \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
62 \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp
63 \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}}
64
65 Constructor, creating and showing a toggle button.
66
67 \wxheading{Parameters}
68
69 \docparam{parent}{Parent window. Must not be {\tt NULL}.}
70
71 \docparam{id}{Toggle button identifier. A value of $-1$ indicates a default value.}
72
73 \docparam{label}{Text to be displayed next to the toggle button.}
74
75 \docparam{pos}{Toggle button position. If the position $(-1, -1)$ is specified then a default position is chosen.}
76
77 \docparam{size}{Toggle button size. If the default size $(-1, -1)$ is specified then a default size is chosen.}
78
79 \docparam{style}{Window style. See \helpref{wxToggleButton}{wxtogglebutton}.}
80
81 \docparam{validator}{Window validator.}
82
83 \docparam{name}{Window name.}
84
85 \wxheading{See also}
86
87 \helpref{wxToggleButton::Create}{wxtogglebuttoncreate}, \helpref{wxValidator}{wxvalidator}
88
89 \membersection{wxToggleButton::\destruct{wxToggleButton}}\label{wxtogglebuttondtor}
90
91 \func{}{\destruct{wxToggleButton}}{\void}
92
93 Destructor, destroying the toggle button.
94
95 \membersection{wxToggleButton::Create}\label{wxtogglebuttoncreate}
96
97 \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
98 \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
99 \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp
100 \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}}
101
102 Creates the toggle button for two-step construction. See \helpref{wxToggleButton::wxToggleButton}{wxtogglebuttonconstr}\rtfsp
103 for details.
104
105 \membersection{wxToggleButton::GetValue}\label{wxtogglebuttongetvalue}
106
107 \constfunc{bool}{GetValue}{\void}
108
109 Gets the state of the toggle button.
110
111 \wxheading{Return value}
112
113 Returns {\tt true} if it is pressed, {\tt false} otherwise.
114
115 \membersection{wxToggleButton::SetValue}\label{wxtogglebuttonsetvalue}
116
117 \func{void}{SetValue}{\param{const bool}{ state}}
118
119 Sets the toggle button to the given state. This does not cause a
120 {\tt EVT\_TOGGLEBUTTON} event to be emitted.
121
122 \wxheading{Parameters}
123
124 \docparam{state}{If {\tt true}, the button is pressed.}
125