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