]>
Commit | Line | Data |
---|---|---|
ecdba0d1 VZ |
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 | ||
8b283bb8 JS |
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 | |
ecdba0d1 VZ |
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 | ||
8b283bb8 | 21 | {\bf NB:} This class is only available under wxMSW and wxGTK currently. |
ecdba0d1 VZ |
22 | |
23 | \wxheading{Derived from} | |
24 | ||
25 | \helpref{wxControl}{wxcontrol}\\ | |
26 | \helpref{wxWindow}{wxwindow}\\ | |
27 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
28 | \helpref{wxObject}{wxobject} | |
29 | ||
30 | \wxheading{Include files} | |
31 | ||
32 | <wx/tglbtn.h> | |
33 | ||
34 | \wxheading{Window styles} | |
35 | ||
36 | There are no special styles for wxToggleButton. | |
37 | ||
38 | See also \helpref{window styles overview}{windowstyles}. | |
39 | ||
40 | \wxheading{Event handling} | |
41 | ||
42 | \twocolwidtha{7cm} | |
43 | \begin{twocollist}\itemsep=0pt | |
44 | \twocolitem{{\bf EVT\_TOGGLEBUTTON(id, func)}}{Handles button click event.} | |
45 | \end{twocollist} | |
46 | ||
47 | \wxheading{See also} | |
48 | ||
49 | \helpref{wxCheckBox}{wxcheckbox}, \helpref{wxButton}{wxbutton} | |
50 | ||
51 | \latexignore{\rtfignore{\wxheading{Members}}} | |
52 | ||
53 | \membersection{wxToggleButton::wxToggleButton}\label{wxtogglebuttonconstr} | |
54 | ||
55 | \func{}{wxToggleButton}{\void} | |
56 | ||
57 | Default constructor. | |
58 | ||
59 | \func{}{wxToggleButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp | |
60 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp | |
61 | \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
62 | \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}} | |
63 | ||
64 | Constructor, creating and showing a toggle button. | |
65 | ||
66 | \wxheading{Parameters} | |
67 | ||
68 | \docparam{parent}{Parent window. Must not be {\tt NULL}.} | |
69 | ||
70 | \docparam{id}{Toggle button identifier. A value of $-1$ indicates a default value.} | |
71 | ||
72 | \docparam{label}{Text to be displayed next to the toggle button.} | |
73 | ||
74 | \docparam{pos}{Toggle button position. If the position $(-1, -1)$ is specified then a default position is chosen.} | |
75 | ||
76 | \docparam{size}{Toggle button size. If the default size $(-1, -1)$ is specified then a default size is chosen.} | |
77 | ||
78 | \docparam{style}{Window style. See \helpref{wxToggleButton}{wxtogglebutton}.} | |
79 | ||
80 | \docparam{validator}{Window validator.} | |
81 | ||
82 | \docparam{name}{Window name.} | |
83 | ||
84 | \wxheading{See also} | |
85 | ||
86 | \helpref{wxToggleButton::Create}{wxtogglebuttoncreate}, \helpref{wxValidator}{wxvalidator} | |
87 | ||
88 | \membersection{wxToggleButton::\destruct{wxToggleButton}} | |
89 | ||
90 | \func{}{\destruct{wxToggleButton}}{\void} | |
91 | ||
92 | Destructor, destroying the toggle button. | |
93 | ||
94 | \membersection{wxToggleButton::Create}\label{wxtogglebuttoncreate} | |
95 | ||
96 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp | |
97 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp | |
98 | \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
99 | \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}} | |
100 | ||
101 | Creates the toggle button for two-step construction. See \helpref{wxToggleButton::wxToggleButton}{wxtogglebuttonconstr}\rtfsp | |
102 | for details. | |
103 | ||
104 | \membersection{wxToggleButton::GetValue}\label{wxtogglebuttongetvalue} | |
105 | ||
106 | \constfunc{bool}{GetValue}{\void} | |
107 | ||
108 | Gets the state of the toggle button. | |
109 | ||
110 | \wxheading{Return value} | |
111 | ||
cc81d32f | 112 | Returns {\tt true} if it is pressed, {\tt false} otherwise. |
ecdba0d1 VZ |
113 | |
114 | \membersection{wxToggleButton::SetValue}\label{wxtogglebuttonsetvalue} | |
115 | ||
116 | \func{void}{SetValue}{\param{const bool}{ state}} | |
117 | ||
8b283bb8 JS |
118 | Sets the toggle button to the given state. This does not cause a |
119 | {\tt EVT\_TOGGLEBUTTON} event to be emitted. | |
ecdba0d1 VZ |
120 | |
121 | \wxheading{Parameters} | |
122 | ||
cc81d32f | 123 | \docparam{state}{If {\tt true}, the button is pressed.} |
ecdba0d1 | 124 |