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