1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxToggleButton documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) 2001 Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxToggleButton
}}\label{wxtogglebutton
}
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
}.
18 You can see wxToggleButton in action in the sixth page of the
19 \helpref{controls
}{samplecontrols
} sample.
21 \wxheading{Derived from
}
23 \helpref{wxControl
}{wxcontrol
}\\
24 \helpref{wxWindow
}{wxwindow
}\\
25 \helpref{wxEvtHandler
}{wxevthandler
}\\
26 \helpref{wxObject
}{wxobject
}
28 \wxheading{Include files
}
34 \helpref{wxCore
}{librarieslist
}
36 \wxheading{Window styles
}
38 There are no special styles for wxToggleButton.
40 See also
\helpref{window styles overview
}{windowstyles
}.
42 \wxheading{Event handling
}
45 \begin{twocollist
}\itemsep=
0pt
46 \twocolitem{{\bf EVT
\_TOGGLEBUTTON(id, func)
}}{Handles a toggle button click event.
}
51 \helpref{wxCheckBox
}{wxcheckbox
},
\helpref{wxButton
}{wxbutton
}
53 \latexignore{\rtfignore{\wxheading{Members
}}}
55 \membersection{wxToggleButton::wxToggleButton
}\label{wxtogglebuttonconstr
}
57 \func{}{wxToggleButton
}{\void}
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"
}}
66 Constructor, creating and showing a toggle button.
68 \wxheading{Parameters
}
70 \docparam{parent
}{Parent window. Must not be
{\tt NULL
}.
}
72 \docparam{id
}{Toggle button identifier. A value of $-
1$ indicates a default value.
}
74 \docparam{label
}{Text to be displayed next to the toggle button.
}
76 \docparam{pos
}{Toggle button position. If the position $(-
1, -
1)$ is specified then a default position is chosen.
}
78 \docparam{size
}{Toggle button size. If the default size $(-
1, -
1)$ is specified then a default size is chosen.
}
80 \docparam{style
}{Window style. See
\helpref{wxToggleButton
}{wxtogglebutton
}.
}
82 \docparam{validator
}{Window validator.
}
84 \docparam{name
}{Window name.
}
88 \helpref{wxToggleButton::Create
}{wxtogglebuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
90 \membersection{wxToggleButton::
\destruct{wxToggleButton
}}\label{wxtogglebuttondtor
}
92 \func{}{\destruct{wxToggleButton
}}{\void}
94 Destructor, destroying the toggle button.
96 \membersection{wxToggleButton::Create
}\label{wxtogglebuttoncreate
}
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"
}}
103 Creates the toggle button for two-step construction. See
\helpref{wxToggleButton::wxToggleButton
}{wxtogglebuttonconstr
}\rtfsp
106 \membersection{wxToggleButton::GetValue
}\label{wxtogglebuttongetvalue
}
108 \constfunc{bool
}{GetValue
}{\void}
110 Gets the state of the toggle button.
112 \wxheading{Return value
}
114 Returns
{\tt true
} if it is pressed,
{\tt false
} otherwise.
116 \membersection{wxToggleButton::SetValue
}\label{wxtogglebuttonsetvalue
}
118 \func{void
}{SetValue
}{\param{bool
}{ state
}}
120 Sets the toggle button to the given state. This does not cause a
121 {\tt EVT
\_TOGGLEBUTTON} event to be emitted.
123 \wxheading{Parameters
}
125 \docparam{state
}{If
{\tt true
}, the button is pressed.
}