]>
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 | |
12 | @wxheader{tglbtn.h} | |
7c913512 | 13 | |
23324ae1 FM |
14 | wxToggleButton is a button that stays pressed when clicked by the user. In |
15 | other words, it is similar to wxCheckBox in | |
16 | 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 | |
23324ae1 | 20 | You can see wxToggleButton in action in the sixth page of the |
e54c96f1 | 21 | controls() sample. |
7c913512 | 22 | |
1f1d2182 | 23 | @beginEventTable{wxCommandEvent} |
8c6791e4 | 24 | @event{EVT_TOGGLEBUTTON(id, func)} |
23324ae1 FM |
25 | Handles a toggle button click event. |
26 | @endEventTable | |
7c913512 | 27 | |
23324ae1 FM |
28 | @library{wxcore} |
29 | @category{ctrl} | |
30 | @appearance{togglebutton.png} | |
7c913512 | 31 | |
e54c96f1 | 32 | @see wxCheckBox, wxButton, wxBitmapToggleButton |
23324ae1 FM |
33 | */ |
34 | class wxToggleButton : public wxControl | |
35 | { | |
36 | public: | |
37 | //@{ | |
38 | /** | |
39 | Constructor, creating and showing a toggle button. | |
3c4f71cc | 40 | |
7c913512 | 41 | @param parent |
4cc4bfaf | 42 | Parent window. Must not be @NULL. |
7c913512 | 43 | @param id |
4cc4bfaf | 44 | Toggle button identifier. The value wxID_ANY indicates a default value. |
7c913512 | 45 | @param label |
4cc4bfaf | 46 | Text to be displayed next to the toggle button. |
7c913512 | 47 | @param pos |
4cc4bfaf FM |
48 | Toggle button position. If wxDefaultPosition is specified then a |
49 | default position is chosen. | |
7c913512 | 50 | @param size |
4cc4bfaf FM |
51 | Toggle button size. If wxDefaultSize is specified then a |
52 | default size is chosen. | |
7c913512 | 53 | @param style |
4cc4bfaf | 54 | Window style. See wxToggleButton. |
7c913512 | 55 | @param validator |
4cc4bfaf | 56 | Window validator. |
7c913512 | 57 | @param name |
4cc4bfaf | 58 | Window name. |
3c4f71cc | 59 | |
4cc4bfaf | 60 | @see Create(), wxValidator |
23324ae1 FM |
61 | */ |
62 | wxToggleButton(); | |
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, |
7c913512 | 69 | const wxString& name = "checkBox"); |
23324ae1 FM |
70 | //@} |
71 | ||
72 | /** | |
73 | Destructor, destroying the toggle button. | |
74 | */ | |
a6052817 | 75 | virtual ~wxToggleButton(); |
23324ae1 FM |
76 | |
77 | /** | |
78 | Creates the toggle button for two-step construction. See wxToggleButton() | |
79 | for details. | |
80 | */ | |
81 | bool Create(wxWindow* parent, wxWindowID id, | |
82 | const wxString& label, | |
83 | const wxPoint& pos = wxDefaultPosition, | |
84 | const wxSize& size = wxDefaultSize, | |
85 | long style = 0, | |
a6052817 | 86 | const wxValidator& val = wxDefaultValidator, |
23324ae1 FM |
87 | const wxString& name = "checkBox"); |
88 | ||
89 | /** | |
90 | Gets the state of the toggle button. | |
3c4f71cc | 91 | |
23324ae1 FM |
92 | @returns Returns @true if it is pressed, @false otherwise. |
93 | */ | |
328f5751 | 94 | bool GetValue() const; |
23324ae1 FM |
95 | |
96 | /** | |
97 | Sets the toggle button to the given state. This does not cause a | |
98 | @c EVT_TOGGLEBUTTON event to be emitted. | |
3c4f71cc | 99 | |
7c913512 | 100 | @param state |
4cc4bfaf | 101 | If @true, the button is pressed. |
23324ae1 FM |
102 | */ |
103 | void SetValue(bool state); | |
104 | }; | |
e54c96f1 | 105 | |
a6052817 FM |
106 | |
107 | /** | |
108 | @class wxBitmapToggleButton | |
109 | @wxheader{tglbtn.h} | |
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} | |
123 | @appearance{bitmaptogglebutton.png} | |
124 | */ | |
125 | class wxBitmapToggleButton : public wxControl | |
126 | { | |
127 | public: | |
128 | //@{ | |
129 | /** | |
130 | Constructor, creating and showing a toggle button with the bitmap @e label. | |
131 | Internally calls Create(). | |
132 | */ | |
133 | wxBitmapToggleButton(); | |
134 | wxBitmapToggleButton(wxWindow* parent, wxWindowID id, | |
135 | const wxBitmap& label, | |
136 | const wxPoint& pos = wxDefaultPosition, | |
137 | const wxSize& size = wxDefaultSize, | |
138 | long style = 0, | |
139 | const wxValidator& val = wxDefaultValidator, | |
140 | const wxString& name = "checkBox"); | |
141 | //@} | |
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, | |
152 | const wxString& name = "checkBox"); | |
153 | ||
154 | /** | |
155 | Gets the state of the toggle button. | |
156 | ||
157 | @returns Returns @true if it is pressed, @false otherwise. | |
158 | */ | |
159 | virtual bool GetValue() const; | |
160 | ||
161 | /** | |
162 | Sets the toggle button to the given state. This does not cause a | |
163 | @c EVT_TOGGLEBUTTON event to be emitted. | |
164 | ||
165 | @param state | |
166 | If @true, the button is pressed. | |
167 | */ | |
168 | virtual void SetValue(bool state); | |
169 | }; | |
170 |