]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxBitmapToggleButton, wxToggleButton
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
13 wxToggleButton is a button that stays pressed when clicked by the user.
14 In other words, it is similar to wxCheckBox in functionality but looks like a wxButton.
16 Since wxWidgets version 2.9.0 this control emits an update UI event.
18 You can see wxToggleButton in action in @ref page_samples_controls.
20 @beginEventEmissionTable{wxCommandEvent}
21 @event{EVT_TOGGLEBUTTON(id, func)}
22 Handles a toggle button click event.
27 @appearance{togglebutton.png}
29 @see wxCheckBox, wxButton, wxBitmapToggleButton
31 class wxToggleButton
: public wxControl
40 Constructor, creating and showing a toggle button.
43 Parent window. Must not be @NULL.
45 Toggle button identifier. The value wxID_ANY indicates a default value.
47 Text to be displayed next to the toggle button.
49 Toggle button position.
50 If ::wxDefaultPosition is specified then a default position is chosen.
53 If ::wxDefaultSize is specified then a default size is chosen.
55 Window style. See wxToggleButton.
61 @see Create(), wxValidator
63 wxToggleButton(wxWindow
* parent
, wxWindowID id
,
64 const wxString
& label
,
65 const wxPoint
& pos
= wxDefaultPosition
,
66 const wxSize
& size
= wxDefaultSize
,
68 const wxValidator
& val
= wxDefaultValidator
,
69 const wxString
& name
= wxCheckBoxNameStr
);
72 Destructor, destroying the toggle button.
74 virtual ~wxToggleButton();
77 Creates the toggle button for two-step construction.
78 See wxToggleButton() for details.
80 bool Create(wxWindow
* parent
, wxWindowID id
,
81 const wxString
& label
,
82 const wxPoint
& pos
= wxDefaultPosition
,
83 const wxSize
& size
= wxDefaultSize
,
85 const wxValidator
& val
= wxDefaultValidator
,
86 const wxString
& name
= wxCheckBoxNameStr
);
89 Gets the state of the toggle button.
91 @return Returns @true if it is pressed, @false otherwise.
93 virtual bool GetValue() const;
96 Sets the toggle button to the given state.
97 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
100 If @true, the button is pressed.
102 virtual void SetValue(bool state
);
107 @class wxBitmapToggleButton
109 wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of
112 This class is not available in all ports currently (although it is
113 available in the major ones), test for @c wxHAS_BITMAPTOGGLEBUTTON to
114 determine whether it can be used (in addition for possibly testing for
115 @c wxUSE_TOGGLEBTN which can be set to 0 to explicitly disable support for
116 this class and wxToggleButton).
118 This control emits an update UI event.
120 @beginEventEmissionTable{wxCommandEvent}
121 @event{EVT_TOGGLEBUTTON(id, func)}
122 Handles a toggle button click event.
127 @appearance{bitmaptogglebutton.png}
129 class wxBitmapToggleButton
: public wxControl
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
);