1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxBitmapToggleButton, wxToggleButton
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 wxEventType wxEVT_TOGGLEBUTTON
;
14 wxToggleButton is a button that stays pressed when clicked by the user.
15 In other words, it is similar to wxCheckBox in functionality but looks like a wxButton.
17 Since wxWidgets version 2.9.0 this control emits an update UI event.
19 You can see wxToggleButton in action in @ref page_samples_controls.
21 @beginEventEmissionTable{wxCommandEvent}
22 @event{EVT_TOGGLEBUTTON(id, func)}
23 Handles a wxEVT_TOGGLEBUTTON event.
28 @appearance{togglebutton}
30 @see wxCheckBox, wxButton, wxBitmapToggleButton
32 class wxToggleButton
: public wxAnyButton
41 Constructor, creating and showing a toggle button.
44 Parent window. Must not be @NULL.
46 Toggle button identifier. The value wxID_ANY indicates a default value.
48 Text to be displayed next to the toggle button.
50 Toggle button position.
51 If ::wxDefaultPosition is specified then a default position is chosen.
54 If ::wxDefaultSize is specified then a default size is chosen.
56 Window style. See wxToggleButton.
62 @see Create(), wxValidator
64 wxToggleButton(wxWindow
* parent
, wxWindowID id
,
65 const wxString
& label
,
66 const wxPoint
& pos
= wxDefaultPosition
,
67 const wxSize
& size
= wxDefaultSize
,
69 const wxValidator
& val
= wxDefaultValidator
,
70 const wxString
& name
= wxCheckBoxNameStr
);
73 Destructor, destroying the toggle button.
75 virtual ~wxToggleButton();
78 Creates the toggle button for two-step construction.
79 See wxToggleButton() for details.
81 bool Create(wxWindow
* parent
, wxWindowID id
,
82 const wxString
& label
,
83 const wxPoint
& pos
= wxDefaultPosition
,
84 const wxSize
& size
= wxDefaultSize
,
86 const wxValidator
& val
= wxDefaultValidator
,
87 const wxString
& name
= wxCheckBoxNameStr
);
90 Gets the state of the toggle button.
92 @return Returns @true if it is pressed, @false otherwise.
94 virtual bool GetValue() const;
97 Sets the toggle button to the given state.
98 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
101 If @true, the button is pressed.
103 virtual void SetValue(bool state
);
108 @class wxBitmapToggleButton
110 wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of
113 This class is not available in all ports currently (although it is
114 available in the major ones), test for @c wxHAS_BITMAPTOGGLEBUTTON to
115 determine whether it can be used (in addition for possibly testing for
116 @c wxUSE_TOGGLEBTN which can be set to 0 to explicitly disable support for
117 this class and wxToggleButton).
119 This control emits an update UI event.
121 @beginEventEmissionTable{wxCommandEvent}
122 @event{EVT_TOGGLEBUTTON(id, func)}
123 Handles a wxEVT_TOGGLEBUTTON event.
129 class wxBitmapToggleButton
: public wxToggleButton
135 wxBitmapToggleButton();
138 Constructor, creating and showing a toggle button with the bitmap @e label.
139 Internally calls Create().
141 wxBitmapToggleButton(wxWindow
* parent
, wxWindowID id
,
142 const wxBitmap
& label
,
143 const wxPoint
& pos
= wxDefaultPosition
,
144 const wxSize
& size
= wxDefaultSize
,
146 const wxValidator
& val
= wxDefaultValidator
,
147 const wxString
& name
= wxCheckBoxNameStr
);
150 Create method for two-step construction.
152 bool Create(wxWindow
* parent
, wxWindowID id
,
153 const wxBitmap
& label
,
154 const wxPoint
& pos
= wxDefaultPosition
,
155 const wxSize
& size
= wxDefaultSize
,
157 const wxValidator
& val
= wxDefaultValidator
,
158 const wxString
& name
= wxCheckBoxNameStr
);
161 Gets the state of the toggle button.
163 @return Returns @true if it is pressed, @false otherwise.
165 virtual bool GetValue() const;
168 Sets the toggle button to the given state.
169 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
172 If @true, the button is pressed.
174 virtual void SetValue(bool state
);