1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxBitmapToggleButton, wxToggleButton
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 wxEventType wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
;
15 wxToggleButton is a button that stays pressed when clicked by the user.
16 In other words, it is similar to wxCheckBox in functionality but looks like a wxButton.
18 Since wxWidgets version 2.9.0 this control emits an update UI event.
20 You can see wxToggleButton in action in @ref page_samples_controls.
22 @beginEventEmissionTable{wxCommandEvent}
23 @event{EVT_TOGGLEBUTTON(id, func)}
24 Handles a wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event.
29 @appearance{togglebutton}
31 @see wxCheckBox, wxButton, wxBitmapToggleButton
33 class wxToggleButton
: public wxAnyButton
42 Constructor, creating and showing a toggle button.
45 Parent window. Must not be @NULL.
47 Toggle button identifier. The value wxID_ANY indicates a default value.
49 Text to be displayed next to the toggle button.
51 Toggle button position.
52 If ::wxDefaultPosition is specified then a default position is chosen.
55 If ::wxDefaultSize is specified then a default size is chosen.
57 Window style. See wxToggleButton.
63 @see Create(), wxValidator
65 wxToggleButton(wxWindow
* parent
, wxWindowID id
,
66 const wxString
& label
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
,
70 const wxValidator
& val
= wxDefaultValidator
,
71 const wxString
& name
= wxCheckBoxNameStr
);
74 Destructor, destroying the toggle button.
76 virtual ~wxToggleButton();
79 Creates the toggle button for two-step construction.
80 See wxToggleButton() for details.
82 bool Create(wxWindow
* parent
, wxWindowID id
,
83 const wxString
& label
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
87 const wxValidator
& val
= wxDefaultValidator
,
88 const wxString
& name
= wxCheckBoxNameStr
);
91 Gets the state of the toggle button.
93 @return Returns @true if it is pressed, @false otherwise.
95 virtual bool GetValue() const;
98 Sets the toggle button to the given state.
99 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
102 If @true, the button is pressed.
104 virtual void SetValue(bool state
);
109 @class wxBitmapToggleButton
111 wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of
114 This class is not available in all ports currently (although it is
115 available in the major ones), test for @c wxHAS_BITMAPTOGGLEBUTTON to
116 determine whether it can be used (in addition for possibly testing for
117 @c wxUSE_TOGGLEBTN which can be set to 0 to explicitly disable support for
118 this class and wxToggleButton).
120 This control emits an update UI event.
122 @beginEventEmissionTable{wxCommandEvent}
123 @event{EVT_TOGGLEBUTTON(id, func)}
124 Handles a wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event.
130 class wxBitmapToggleButton
: public wxToggleButton
136 wxBitmapToggleButton();
139 Constructor, creating and showing a toggle button with the bitmap @e label.
140 Internally calls Create().
142 wxBitmapToggleButton(wxWindow
* parent
, wxWindowID id
,
143 const wxBitmap
& label
,
144 const wxPoint
& pos
= wxDefaultPosition
,
145 const wxSize
& size
= wxDefaultSize
,
147 const wxValidator
& val
= wxDefaultValidator
,
148 const wxString
& name
= wxCheckBoxNameStr
);
151 Create method for two-step construction.
153 bool Create(wxWindow
* parent
, wxWindowID id
,
154 const wxBitmap
& label
,
155 const wxPoint
& pos
= wxDefaultPosition
,
156 const wxSize
& size
= wxDefaultSize
,
158 const wxValidator
& val
= wxDefaultValidator
,
159 const wxString
& name
= wxCheckBoxNameStr
);
162 Gets the state of the toggle button.
164 @return Returns @true if it is pressed, @false otherwise.
166 virtual bool GetValue() const;
169 Sets the toggle button to the given state.
170 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
173 If @true, the button is pressed.
175 virtual void SetValue(bool state
);