]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/tglbtn.h
Add wxTimer::StartOnce().
[wxWidgets.git] / interface / wx / tglbtn.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: tglbtn.h
78e87bf7 3// Purpose: interface of wxBitmapToggleButton, wxToggleButton
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
e54c96f1 9
ce7fe42e 10wxEventType wxEVT_TOGGLEBUTTON;
dec0a353 11
23324ae1
FM
12/**
13 @class wxToggleButton
7c913512 14
78e87bf7
FM
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.
7c913512 17
23324ae1 18 Since wxWidgets version 2.9.0 this control emits an update UI event.
7c913512 19
78e87bf7 20 You can see wxToggleButton in action in @ref page_samples_controls.
7c913512 21
3051a44a 22 @beginEventEmissionTable{wxCommandEvent}
8c6791e4 23 @event{EVT_TOGGLEBUTTON(id, func)}
ce7fe42e 24 Handles a wxEVT_TOGGLEBUTTON event.
23324ae1 25 @endEventTable
7c913512 26
23324ae1
FM
27 @library{wxcore}
28 @category{ctrl}
ce154616 29 @appearance{togglebutton}
7c913512 30
e54c96f1 31 @see wxCheckBox, wxButton, wxBitmapToggleButton
23324ae1 32*/
884a3e9d 33class wxToggleButton : public wxAnyButton
23324ae1
FM
34{
35public:
23ae751e
RR
36 /**
37 Default constructor.
38 */
39 wxToggleButton();
98ccd545 40
23324ae1
FM
41 /**
42 Constructor, creating and showing a toggle button.
3c4f71cc 43
7c913512 44 @param parent
4cc4bfaf 45 Parent window. Must not be @NULL.
7c913512 46 @param id
4cc4bfaf 47 Toggle button identifier. The value wxID_ANY indicates a default value.
7c913512 48 @param label
4cc4bfaf 49 Text to be displayed next to the toggle button.
7c913512 50 @param pos
78e87bf7 51 Toggle button position.
dc1b07fd 52 If ::wxDefaultPosition is specified then a default position is chosen.
7c913512 53 @param size
78e87bf7 54 Toggle button size.
dc1b07fd 55 If ::wxDefaultSize is specified then a default size is chosen.
7c913512 56 @param style
4cc4bfaf 57 Window style. See wxToggleButton.
77bfb902 58 @param val
4cc4bfaf 59 Window validator.
7c913512 60 @param name
4cc4bfaf 61 Window name.
3c4f71cc 62
4cc4bfaf 63 @see Create(), wxValidator
23324ae1 64 */
7c913512
FM
65 wxToggleButton(wxWindow* parent, wxWindowID id,
66 const wxString& label,
67 const wxPoint& pos = wxDefaultPosition,
68 const wxSize& size = wxDefaultSize,
69 long style = 0,
a6052817 70 const wxValidator& val = wxDefaultValidator,
98ccd545 71 const wxString& name = wxCheckBoxNameStr);
23324ae1
FM
72
73 /**
74 Destructor, destroying the toggle button.
75 */
a6052817 76 virtual ~wxToggleButton();
23324ae1
FM
77
78 /**
78e87bf7
FM
79 Creates the toggle button for two-step construction.
80 See wxToggleButton() for details.
23324ae1
FM
81 */
82 bool Create(wxWindow* parent, wxWindowID id,
83 const wxString& label,
84 const wxPoint& pos = wxDefaultPosition,
85 const wxSize& size = wxDefaultSize,
86 long style = 0,
a6052817 87 const wxValidator& val = wxDefaultValidator,
98ccd545 88 const wxString& name = wxCheckBoxNameStr);
23324ae1
FM
89
90 /**
91 Gets the state of the toggle button.
3c4f71cc 92
d29a9a8a 93 @return Returns @true if it is pressed, @false otherwise.
23324ae1 94 */
adaaa686 95 virtual bool GetValue() const;
23324ae1
FM
96
97 /**
78e87bf7
FM
98 Sets the toggle button to the given state.
99 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
3c4f71cc 100
7c913512 101 @param state
4cc4bfaf 102 If @true, the button is pressed.
23324ae1 103 */
adaaa686 104 virtual void SetValue(bool state);
23324ae1 105};
e54c96f1 106
a6052817
FM
107
108/**
109 @class wxBitmapToggleButton
a6052817 110
323d36e4
VZ
111 wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of
112 text.
113
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).
a6052817
FM
119
120 This control emits an update UI event.
121
3051a44a 122 @beginEventEmissionTable{wxCommandEvent}
8c6791e4 123 @event{EVT_TOGGLEBUTTON(id, func)}
ce7fe42e 124 Handles a wxEVT_TOGGLEBUTTON event.
a6052817
FM
125 @endEventTable
126
127 @library{wxcore}
128 @category{ctrl}
a6052817 129*/
884a3e9d 130class wxBitmapToggleButton : public wxToggleButton
a6052817
FM
131{
132public:
23ae751e
RR
133 /**
134 Default constructor.
135 */
136 wxBitmapToggleButton();
98ccd545 137
a6052817
FM
138 /**
139 Constructor, creating and showing a toggle button with the bitmap @e label.
140 Internally calls Create().
141 */
a6052817
FM
142 wxBitmapToggleButton(wxWindow* parent, wxWindowID id,
143 const wxBitmap& label,
144 const wxPoint& pos = wxDefaultPosition,
145 const wxSize& size = wxDefaultSize,
146 long style = 0,
147 const wxValidator& val = wxDefaultValidator,
98ccd545 148 const wxString& name = wxCheckBoxNameStr);
a6052817
FM
149
150 /**
151 Create method for two-step construction.
152 */
153 bool Create(wxWindow* parent, wxWindowID id,
154 const wxBitmap& label,
155 const wxPoint& pos = wxDefaultPosition,
156 const wxSize& size = wxDefaultSize,
157 long style = 0,
158 const wxValidator& val = wxDefaultValidator,
98ccd545 159 const wxString& name = wxCheckBoxNameStr);
a6052817
FM
160
161 /**
162 Gets the state of the toggle button.
163
d29a9a8a 164 @return Returns @true if it is pressed, @false otherwise.
a6052817
FM
165 */
166 virtual bool GetValue() const;
167
168 /**
78e87bf7
FM
169 Sets the toggle button to the given state.
170 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
a6052817
FM
171
172 @param state
173 If @true, the button is pressed.
174 */
175 virtual void SetValue(bool state);
176};
177