| 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 | Since wxWidgets version 2.9.0 this control emits an update UI event. |
| 19 | |
| 20 | You can see wxToggleButton in action in the sixth page of the |
| 21 | \helpref{controls}{samplecontrols} sample. |
| 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{Library} |
| 35 | |
| 36 | \helpref{wxCore}{librarieslist} |
| 37 | |
| 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 |
| 48 | \twocolitem{{\bf EVT\_TOGGLEBUTTON(id, func)}}{Handles a toggle button click event.} |
| 49 | \end{twocollist} |
| 50 | |
| 51 | \wxheading{See also} |
| 52 | |
| 53 | \helpref{wxCheckBox}{wxcheckbox}, \helpref{wxButton}{wxbutton}, |
| 54 | \helpref{wxBitmapToggleButton}{wxbitmaptogglebutton} |
| 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 | |
| 93 | \membersection{wxToggleButton::\destruct{wxToggleButton}}\label{wxtogglebuttondtor} |
| 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 | |
| 117 | Returns {\tt true} if it is pressed, {\tt false} otherwise. |
| 118 | |
| 119 | \membersection{wxToggleButton::SetValue}\label{wxtogglebuttonsetvalue} |
| 120 | |
| 121 | \func{void}{SetValue}{\param{bool}{ state}} |
| 122 | |
| 123 | Sets the toggle button to the given state. This does not cause a |
| 124 | {\tt EVT\_TOGGLEBUTTON} event to be emitted. |
| 125 | |
| 126 | \wxheading{Parameters} |
| 127 | |
| 128 | \docparam{state}{If {\tt true}, the button is pressed.} |
| 129 | |