]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/tglbtn.h
Add wxProgressDialog::Was{Cancelled,Skipped}() convenience methods.
[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$
6// Licence: wxWindows license
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)}
3051a44a 22 Handles a toggle button click event.
23324ae1 23 @endEventTable
7c913512 24
23324ae1
FM
25 @library{wxcore}
26 @category{ctrl}
7e59b885 27 @appearance{togglebutton.png}
7c913512 28
e54c96f1 29 @see wxCheckBox, wxButton, wxBitmapToggleButton
23324ae1
FM
30*/
31class wxToggleButton : public wxControl
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
FM
108
109 wxBitmapToggleButton is a wxToggleButton
110 that contains a bitmap instead of text.
111
112 This control emits an update UI event.
113
3051a44a 114 @beginEventEmissionTable{wxCommandEvent}
8c6791e4 115 @event{EVT_TOGGLEBUTTON(id, func)}
3051a44a 116 Handles a toggle button click event.
a6052817
FM
117 @endEventTable
118
119 @library{wxcore}
120 @category{ctrl}
7e59b885 121 @appearance{bitmaptogglebutton.png}
a6052817
FM
122*/
123class wxBitmapToggleButton : public wxControl
124{
125public:
23ae751e
RR
126 /**
127 Default constructor.
128 */
129 wxBitmapToggleButton();
98ccd545 130
a6052817
FM
131 /**
132 Constructor, creating and showing a toggle button with the bitmap @e label.
133 Internally calls Create().
134 */
a6052817
FM
135 wxBitmapToggleButton(wxWindow* parent, wxWindowID id,
136 const wxBitmap& label,
137 const wxPoint& pos = wxDefaultPosition,
138 const wxSize& size = wxDefaultSize,
139 long style = 0,
140 const wxValidator& val = wxDefaultValidator,
98ccd545 141 const wxString& name = wxCheckBoxNameStr);
a6052817
FM
142
143 /**
144 Create method for two-step construction.
145 */
146 bool Create(wxWindow* parent, wxWindowID id,
147 const wxBitmap& label,
148 const wxPoint& pos = wxDefaultPosition,
149 const wxSize& size = wxDefaultSize,
150 long style = 0,
151 const wxValidator& val = wxDefaultValidator,
98ccd545 152 const wxString& name = wxCheckBoxNameStr);
a6052817
FM
153
154 /**
155 Gets the state of the toggle button.
156
d29a9a8a 157 @return Returns @true if it is pressed, @false otherwise.
a6052817
FM
158 */
159 virtual bool GetValue() const;
160
161 /**
78e87bf7
FM
162 Sets the toggle button to the given state.
163 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
a6052817
FM
164
165 @param state
166 If @true, the button is pressed.
167 */
168 virtual void SetValue(bool state);
169};
170