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 Since wxWidgets version
2.9.0 this control emits an update UI event.
20 You can see wxToggleButton in action in the sixth page of the
21 \helpref{controls
}{samplecontrols
} sample.
23 \wxheading{Derived from
}
25 \helpref{wxControl
}{wxcontrol
}\\
26 \helpref{wxWindow
}{wxwindow
}\\
27 \helpref{wxEvtHandler
}{wxevthandler
}\\
28 \helpref{wxObject
}{wxobject
}
30 \wxheading{Include files
}
36 \helpref{wxCore
}{librarieslist
}
38 \wxheading{Window styles
}
40 There are no special styles for wxToggleButton.
42 See also
\helpref{window styles overview
}{windowstyles
}.
44 \wxheading{Event handling
}
47 \begin{twocollist
}\itemsep=
0pt
48 \twocolitem{{\bf EVT
\_TOGGLEBUTTON(id, func)
}}{Handles a toggle button click event.
}
53 \helpref{wxCheckBox
}{wxcheckbox
},
\helpref{wxButton
}{wxbutton
},
54 \helpref{wxBitmapToggleButton
}{wxbitmaptogglebutton
}
56 \latexignore{\rtfignore{\wxheading{Members
}}}
58 \membersection{wxToggleButton::wxToggleButton
}\label{wxtogglebuttonconstr
}
60 \func{}{wxToggleButton
}{\void}
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"
}}
69 Constructor, creating and showing a toggle button.
71 \wxheading{Parameters
}
73 \docparam{parent
}{Parent window. Must not be
{\tt NULL
}.
}
75 \docparam{id
}{Toggle button identifier. A value of $-
1$ indicates a default value.
}
77 \docparam{label
}{Text to be displayed next to the toggle button.
}
79 \docparam{pos
}{Toggle button position. If the position $(-
1, -
1)$ is specified then a default position is chosen.
}
81 \docparam{size
}{Toggle button size. If the default size $(-
1, -
1)$ is specified then a default size is chosen.
}
83 \docparam{style
}{Window style. See
\helpref{wxToggleButton
}{wxtogglebutton
}.
}
85 \docparam{validator
}{Window validator.
}
87 \docparam{name
}{Window name.
}
91 \helpref{wxToggleButton::Create
}{wxtogglebuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
93 \membersection{wxToggleButton::
\destruct{wxToggleButton
}}\label{wxtogglebuttondtor
}
95 \func{}{\destruct{wxToggleButton
}}{\void}
97 Destructor, destroying the toggle button.
99 \membersection{wxToggleButton::Create
}\label{wxtogglebuttoncreate
}
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"
}}
106 Creates the toggle button for two-step construction. See
\helpref{wxToggleButton::wxToggleButton
}{wxtogglebuttonconstr
}\rtfsp
109 \membersection{wxToggleButton::GetValue
}\label{wxtogglebuttongetvalue
}
111 \constfunc{bool
}{GetValue
}{\void}
113 Gets the state of the toggle button.
115 \wxheading{Return value
}
117 Returns
{\tt true
} if it is pressed,
{\tt false
} otherwise.
119 \membersection{wxToggleButton::SetValue
}\label{wxtogglebuttonsetvalue
}
121 \func{void
}{SetValue
}{\param{bool
}{ state
}}
123 Sets the toggle button to the given state. This does not cause a
124 {\tt EVT
\_TOGGLEBUTTON} event to be emitted.
126 \wxheading{Parameters
}
128 \docparam{state
}{If
{\tt true
}, the button is pressed.
}