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 {\bf NB:
} This class is only available under wxMSW and wxGTK currently.
23 \wxheading{Derived from
}
25 \helpref{wxControl
}{wxcontrol
}\\
26 \helpref{wxWindow
}{wxwindow
}\\
27 \helpref{wxEvtHandler
}{wxevthandler
}\\
28 \helpref{wxObject
}{wxobject
}
30 \wxheading{Include files
}
34 \wxheading{Window styles
}
36 There are no special styles for wxToggleButton.
38 See also
\helpref{window styles overview
}{windowstyles
}.
40 \wxheading{Event handling
}
43 \begin{twocollist
}\itemsep=
0pt
44 \twocolitem{{\bf EVT
\_TOGGLEBUTTON(id, func)
}}{Handles button click event.
}
49 \helpref{wxCheckBox
}{wxcheckbox
},
\helpref{wxButton
}{wxbutton
}
51 \latexignore{\rtfignore{\wxheading{Members
}}}
53 \membersection{wxToggleButton::wxToggleButton
}\label{wxtogglebuttonconstr
}
55 \func{}{wxToggleButton
}{\void}
59 \func{}{wxToggleButton
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
60 \param{const wxString\&
}{label
},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
61 \param{const wxSize\&
}{size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
62 \param{const wxValidator\&
}{val
},
\param{const wxString\&
}{name = ``checkBox"
}}
64 Constructor, creating and showing a toggle button.
66 \wxheading{Parameters
}
68 \docparam{parent
}{Parent window. Must not be
{\tt NULL
}.
}
70 \docparam{id
}{Toggle button identifier. A value of $-
1$ indicates a default value.
}
72 \docparam{label
}{Text to be displayed next to the toggle button.
}
74 \docparam{pos
}{Toggle button position. If the position $(-
1, -
1)$ is specified then a default position is chosen.
}
76 \docparam{size
}{Toggle button size. If the default size $(-
1, -
1)$ is specified then a default size is chosen.
}
78 \docparam{style
}{Window style. See
\helpref{wxToggleButton
}{wxtogglebutton
}.
}
80 \docparam{validator
}{Window validator.
}
82 \docparam{name
}{Window name.
}
86 \helpref{wxToggleButton::Create
}{wxtogglebuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
88 \membersection{wxToggleButton::
\destruct{wxToggleButton
}}
90 \func{}{\destruct{wxToggleButton
}}{\void}
92 Destructor, destroying the toggle button.
94 \membersection{wxToggleButton::Create
}\label{wxtogglebuttoncreate
}
96 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
97 \param{const wxString\&
}{label
},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
98 \param{const wxSize\&
}{size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
99 \param{const wxValidator\&
}{val
},
\param{const wxString\&
}{name = ``checkBox"
}}
101 Creates the toggle button for two-step construction. See
\helpref{wxToggleButton::wxToggleButton
}{wxtogglebuttonconstr
}\rtfsp
104 \membersection{wxToggleButton::GetValue
}\label{wxtogglebuttongetvalue
}
106 \constfunc{bool
}{GetValue
}{\void}
108 Gets the state of the toggle button.
110 \wxheading{Return value
}
112 Returns
{\tt true
} if it is pressed,
{\tt false
} otherwise.
114 \membersection{wxToggleButton::SetValue
}\label{wxtogglebuttonsetvalue
}
116 \func{void
}{SetValue
}{\param{const bool
}{ state
}}
118 Sets the toggle button to the given state. This does not cause a
119 {\tt EVT
\_TOGGLEBUTTON} event to be emitted.
121 \wxheading{Parameters
}
123 \docparam{state
}{If
{\tt true
}, the button is pressed.
}