]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxBitmapToggleButton
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 wxToggleButton is a button that stays pressed when clicked by the user. In
14 other words, it is similar to wxCheckBox in
15 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 the sixth page of the
22 @beginEventTable{wxCommandEvent}
23 @event{EVT_TOGGLEBUTTON(id, func)}
24 Handles a toggle button click event.
29 <!-- @appearance{togglebutton.png} -->
31 @see wxCheckBox, wxButton, wxBitmapToggleButton
33 class wxToggleButton
: public wxControl
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. If wxDefaultPosition is specified then a
52 default position is chosen.
54 Toggle button size. If wxDefaultSize is specified then a
55 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. See wxToggleButton()
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 bool GetValue() const;
98 Sets the toggle button to the given state. This does not cause a
99 @c EVT_TOGGLEBUTTON event to be emitted.
102 If @true, the button is pressed.
104 void SetValue(bool state
);
109 @class wxBitmapToggleButton
111 wxBitmapToggleButton is a wxToggleButton
112 that contains a bitmap instead of text.
114 This control emits an update UI event.
116 @beginEventTable{wxCommandEvent}
117 @event{EVT_TOGGLEBUTTON(id, func)}
118 Handles a toggle button click event.
123 <!-- @appearance{bitmaptogglebutton.png} -->
125 class wxBitmapToggleButton
: public wxControl
131 wxBitmapToggleButton();
134 Constructor, creating and showing a toggle button with the bitmap @e label.
135 Internally calls Create().
137 wxBitmapToggleButton(wxWindow
* parent
, wxWindowID id
,
138 const wxBitmap
& label
,
139 const wxPoint
& pos
= wxDefaultPosition
,
140 const wxSize
& size
= wxDefaultSize
,
142 const wxValidator
& val
= wxDefaultValidator
,
143 const wxString
& name
= wxCheckBoxNameStr
);
146 Create method for two-step construction.
148 bool Create(wxWindow
* parent
, wxWindowID id
,
149 const wxBitmap
& label
,
150 const wxPoint
& pos
= wxDefaultPosition
,
151 const wxSize
& size
= wxDefaultSize
,
153 const wxValidator
& val
= wxDefaultValidator
,
154 const wxString
& name
= wxCheckBoxNameStr
);
157 Gets the state of the toggle button.
159 @return Returns @true if it is pressed, @false otherwise.
161 virtual bool GetValue() const;
164 Sets the toggle button to the given state. This does not cause a
165 @c EVT_TOGGLEBUTTON event to be emitted.
168 If @true, the button is pressed.
170 virtual void SetValue(bool state
);