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