]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tglbtn.h | |
e54c96f1 | 3 | // Purpose: interface of wxBitmapToggleButton |
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 | |
23324ae1 FM |
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. | |
7c913512 | 16 | |
23324ae1 | 17 | Since wxWidgets version 2.9.0 this control emits an update UI event. |
7c913512 | 18 | |
23324ae1 | 19 | You can see wxToggleButton in action in the sixth page of the |
e54c96f1 | 20 | controls() sample. |
7c913512 | 21 | |
1f1d2182 | 22 | @beginEventTable{wxCommandEvent} |
8c6791e4 | 23 | @event{EVT_TOGGLEBUTTON(id, func)} |
23324ae1 FM |
24 | Handles a toggle button click event. |
25 | @endEventTable | |
7c913512 | 26 | |
23324ae1 FM |
27 | @library{wxcore} |
28 | @category{ctrl} | |
0c7fe6f2 | 29 | <!-- @appearance{togglebutton.png} --> |
7c913512 | 30 | |
e54c96f1 | 31 | @see wxCheckBox, wxButton, wxBitmapToggleButton |
23324ae1 FM |
32 | */ |
33 | class wxToggleButton : public wxControl | |
34 | { | |
35 | public: | |
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 |
4cc4bfaf FM |
51 | Toggle button position. If wxDefaultPosition is specified then a |
52 | default position is chosen. | |
7c913512 | 53 | @param size |
4cc4bfaf FM |
54 | Toggle button size. If wxDefaultSize is specified then a |
55 | default size is chosen. | |
7c913512 | 56 | @param style |
4cc4bfaf | 57 | Window style. See wxToggleButton. |
7c913512 | 58 | @param validator |
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 | /** | |
79 | Creates the toggle button for two-step construction. See wxToggleButton() | |
80 | for details. | |
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 | /** | |
98 | Sets the toggle button to the given state. This does not cause a | |
99 | @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 FM |
110 | |
111 | wxBitmapToggleButton is a wxToggleButton | |
112 | that contains a bitmap instead of text. | |
113 | ||
114 | This control emits an update UI event. | |
115 | ||
1f1d2182 | 116 | @beginEventTable{wxCommandEvent} |
8c6791e4 | 117 | @event{EVT_TOGGLEBUTTON(id, func)} |
a6052817 FM |
118 | Handles a toggle button click event. |
119 | @endEventTable | |
120 | ||
121 | @library{wxcore} | |
122 | @category{ctrl} | |
0c7fe6f2 | 123 | <!-- @appearance{bitmaptogglebutton.png} --> |
a6052817 FM |
124 | */ |
125 | class wxBitmapToggleButton : public wxControl | |
126 | { | |
127 | public: | |
23ae751e RR |
128 | /** |
129 | Default constructor. | |
130 | */ | |
131 | wxBitmapToggleButton(); | |
98ccd545 | 132 | |
a6052817 FM |
133 | /** |
134 | Constructor, creating and showing a toggle button with the bitmap @e label. | |
135 | Internally calls Create(). | |
136 | */ | |
a6052817 FM |
137 | wxBitmapToggleButton(wxWindow* parent, wxWindowID id, |
138 | const wxBitmap& label, | |
139 | const wxPoint& pos = wxDefaultPosition, | |
140 | const wxSize& size = wxDefaultSize, | |
141 | long style = 0, | |
142 | const wxValidator& val = wxDefaultValidator, | |
98ccd545 | 143 | const wxString& name = wxCheckBoxNameStr); |
a6052817 FM |
144 | |
145 | /** | |
146 | Create method for two-step construction. | |
147 | */ | |
148 | bool Create(wxWindow* parent, wxWindowID id, | |
149 | const wxBitmap& label, | |
150 | const wxPoint& pos = wxDefaultPosition, | |
151 | const wxSize& size = wxDefaultSize, | |
152 | long style = 0, | |
153 | const wxValidator& val = wxDefaultValidator, | |
98ccd545 | 154 | const wxString& name = wxCheckBoxNameStr); |
a6052817 FM |
155 | |
156 | /** | |
157 | Gets the state of the toggle button. | |
158 | ||
d29a9a8a | 159 | @return Returns @true if it is pressed, @false otherwise. |
a6052817 FM |
160 | */ |
161 | virtual bool GetValue() const; | |
162 | ||
163 | /** | |
164 | Sets the toggle button to the given state. This does not cause a | |
165 | @c EVT_TOGGLEBUTTON event to be emitted. | |
166 | ||
167 | @param state | |
168 | If @true, the button is pressed. | |
169 | */ | |
170 | virtual void SetValue(bool state); | |
171 | }; | |
172 |