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 not available under wxUniversal ports such
24 \wxheading{Derived from
}
26 \helpref{wxControl
}{wxcontrol
}\\
27 \helpref{wxWindow
}{wxwindow
}\\
28 \helpref{wxEvtHandler
}{wxevthandler
}\\
29 \helpref{wxObject
}{wxobject
}
31 \wxheading{Include files
}
35 \wxheading{Window styles
}
37 There are no special styles for wxToggleButton.
39 See also
\helpref{window styles overview
}{windowstyles
}.
41 \wxheading{Event handling
}
44 \begin{twocollist
}\itemsep=
0pt
45 \twocolitem{{\bf EVT
\_TOGGLEBUTTON(id, func)
}}{Handles button click event.
}
50 \helpref{wxCheckBox
}{wxcheckbox
},
\helpref{wxButton
}{wxbutton
}
52 \latexignore{\rtfignore{\wxheading{Members
}}}
54 \membersection{wxToggleButton::wxToggleButton
}\label{wxtogglebuttonconstr
}
56 \func{}{wxToggleButton
}{\void}
60 \func{}{wxToggleButton
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
61 \param{const wxString\&
}{label
},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
62 \param{const wxSize\&
}{size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
63 \param{const wxValidator\&
}{val
},
\param{const wxString\&
}{name = ``checkBox"
}}
65 Constructor, creating and showing a toggle button.
67 \wxheading{Parameters
}
69 \docparam{parent
}{Parent window. Must not be
{\tt NULL
}.
}
71 \docparam{id
}{Toggle button identifier. A value of $-
1$ indicates a default value.
}
73 \docparam{label
}{Text to be displayed next to the toggle button.
}
75 \docparam{pos
}{Toggle button position. If the position $(-
1, -
1)$ is specified then a default position is chosen.
}
77 \docparam{size
}{Toggle button size. If the default size $(-
1, -
1)$ is specified then a default size is chosen.
}
79 \docparam{style
}{Window style. See
\helpref{wxToggleButton
}{wxtogglebutton
}.
}
81 \docparam{validator
}{Window validator.
}
83 \docparam{name
}{Window name.
}
87 \helpref{wxToggleButton::Create
}{wxtogglebuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
89 \membersection{wxToggleButton::
\destruct{wxToggleButton
}}\label{wxtogglebuttondtor
}
91 \func{}{\destruct{wxToggleButton
}}{\void}
93 Destructor, destroying the toggle button.
95 \membersection{wxToggleButton::Create
}\label{wxtogglebuttoncreate
}
97 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
98 \param{const wxString\&
}{label
},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
99 \param{const wxSize\&
}{size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
100 \param{const wxValidator\&
}{val
},
\param{const wxString\&
}{name = ``checkBox"
}}
102 Creates the toggle button for two-step construction. See
\helpref{wxToggleButton::wxToggleButton
}{wxtogglebuttonconstr
}\rtfsp
105 \membersection{wxToggleButton::GetValue
}\label{wxtogglebuttongetvalue
}
107 \constfunc{bool
}{GetValue
}{\void}
109 Gets the state of the toggle button.
111 \wxheading{Return value
}
113 Returns
{\tt true
} if it is pressed,
{\tt false
} otherwise.
115 \membersection{wxToggleButton::SetValue
}\label{wxtogglebuttonsetvalue
}
117 \func{void
}{SetValue
}{\param{const bool
}{ state
}}
119 Sets the toggle button to the given state. This does not cause a
120 {\tt EVT
\_TOGGLEBUTTON} event to be emitted.
122 \wxheading{Parameters
}
124 \docparam{state
}{If
{\tt true
}, the button is pressed.
}