]>
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 | |
8795498c | 9 | %% License: wxWindows license |
ecdba0d1 VZ |
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 | ||
940cc794 | 18 | Since wxWidgets version 2.9.0 this control emits an update UI event. |
10ff9c61 | 19 | |
0a87ef19 | 20 | You can see wxToggleButton in action in the sixth page of the |
ecdba0d1 VZ |
21 | \helpref{controls}{samplecontrols} sample. |
22 | ||
ecdba0d1 VZ |
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 | ||
a7af285d VZ |
34 | \wxheading{Library} |
35 | ||
36 | \helpref{wxCore}{librarieslist} | |
37 | ||
ecdba0d1 VZ |
38 | \wxheading{Window styles} |
39 | ||
40 | There are no special styles for wxToggleButton. | |
41 | ||
42 | See also \helpref{window styles overview}{windowstyles}. | |
43 | ||
44 | \wxheading{Event handling} | |
45 | ||
46 | \twocolwidtha{7cm} | |
47 | \begin{twocollist}\itemsep=0pt | |
20f82e13 | 48 | \twocolitem{{\bf EVT\_TOGGLEBUTTON(id, func)}}{Handles a toggle button click event.} |
ecdba0d1 VZ |
49 | \end{twocollist} |
50 | ||
51 | \wxheading{See also} | |
52 | ||
10ff9c61 | 53 | \helpref{wxCheckBox}{wxcheckbox}, \helpref{wxButton}{wxbutton}, |
8b9d9fa8 | 54 | \helpref{wxBitmapToggleButton}{wxbitmaptogglebutton} |
ecdba0d1 VZ |
55 | |
56 | \latexignore{\rtfignore{\wxheading{Members}}} | |
57 | ||
58 | \membersection{wxToggleButton::wxToggleButton}\label{wxtogglebuttonconstr} | |
59 | ||
60 | \func{}{wxToggleButton}{\void} | |
61 | ||
62 | Default constructor. | |
63 | ||
64 | \func{}{wxToggleButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp | |
65 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp | |
66 | \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
67 | \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}} | |
68 | ||
69 | Constructor, creating and showing a toggle button. | |
70 | ||
71 | \wxheading{Parameters} | |
72 | ||
73 | \docparam{parent}{Parent window. Must not be {\tt NULL}.} | |
74 | ||
75 | \docparam{id}{Toggle button identifier. A value of $-1$ indicates a default value.} | |
76 | ||
77 | \docparam{label}{Text to be displayed next to the toggle button.} | |
78 | ||
79 | \docparam{pos}{Toggle button position. If the position $(-1, -1)$ is specified then a default position is chosen.} | |
80 | ||
81 | \docparam{size}{Toggle button size. If the default size $(-1, -1)$ is specified then a default size is chosen.} | |
82 | ||
83 | \docparam{style}{Window style. See \helpref{wxToggleButton}{wxtogglebutton}.} | |
84 | ||
85 | \docparam{validator}{Window validator.} | |
86 | ||
87 | \docparam{name}{Window name.} | |
88 | ||
89 | \wxheading{See also} | |
90 | ||
91 | \helpref{wxToggleButton::Create}{wxtogglebuttoncreate}, \helpref{wxValidator}{wxvalidator} | |
92 | ||
6d06e061 | 93 | \membersection{wxToggleButton::\destruct{wxToggleButton}}\label{wxtogglebuttondtor} |
ecdba0d1 VZ |
94 | |
95 | \func{}{\destruct{wxToggleButton}}{\void} | |
96 | ||
97 | Destructor, destroying the toggle button. | |
98 | ||
99 | \membersection{wxToggleButton::Create}\label{wxtogglebuttoncreate} | |
100 | ||
101 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp | |
102 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp | |
103 | \param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
104 | \param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}} | |
105 | ||
106 | Creates the toggle button for two-step construction. See \helpref{wxToggleButton::wxToggleButton}{wxtogglebuttonconstr}\rtfsp | |
107 | for details. | |
108 | ||
109 | \membersection{wxToggleButton::GetValue}\label{wxtogglebuttongetvalue} | |
110 | ||
111 | \constfunc{bool}{GetValue}{\void} | |
112 | ||
113 | Gets the state of the toggle button. | |
114 | ||
115 | \wxheading{Return value} | |
116 | ||
cc81d32f | 117 | Returns {\tt true} if it is pressed, {\tt false} otherwise. |
ecdba0d1 VZ |
118 | |
119 | \membersection{wxToggleButton::SetValue}\label{wxtogglebuttonsetvalue} | |
120 | ||
e31f4da5 | 121 | \func{void}{SetValue}{\param{bool}{ state}} |
ecdba0d1 | 122 | |
0a87ef19 | 123 | Sets the toggle button to the given state. This does not cause a |
8b283bb8 | 124 | {\tt EVT\_TOGGLEBUTTON} event to be emitted. |
ecdba0d1 VZ |
125 | |
126 | \wxheading{Parameters} | |
127 | ||
cc81d32f | 128 | \docparam{state}{If {\tt true}, the button is pressed.} |
10ff9c61 | 129 |