]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: controls.i | |
3 | // Purpose: Control (widget) classes for wxPython | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/10/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
03e9bead | 13 | %module controls |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 RD |
16 | #include "helpers.h" |
17 | #include <wx/slider.h> | |
fb5e0af0 RD |
18 | |
19 | #ifdef __WXMSW__ | |
7bf85405 | 20 | #include <wx/spinbutt.h> |
fb5e0af0 | 21 | #endif |
7bf85405 RD |
22 | %} |
23 | ||
24 | //---------------------------------------------------------------------- | |
25 | ||
26 | %include typemaps.i | |
27 | %include my_typemaps.i | |
28 | ||
29 | // Import some definitions of other classes, etc. | |
30 | %import _defs.i | |
31 | %import misc.i | |
32 | %import windows.i | |
33 | %import gdi.i | |
34 | %import events.i | |
35 | ||
36 | //---------------------------------------------------------------------- | |
37 | ||
38 | %{ | |
39 | wxValidator wxPyDefaultValidator; // Non-const default because of SWIG | |
40 | %} | |
41 | ||
42 | //---------------------------------------------------------------------- | |
43 | ||
44 | class wxControl : public wxWindow { | |
45 | public: | |
46 | void Command(wxCommandEvent& event); | |
fb5e0af0 | 47 | wxString GetLabel(); |
7bf85405 RD |
48 | void SetLabel(const wxString& label); |
49 | }; | |
50 | ||
51 | //---------------------------------------------------------------------- | |
52 | ||
53 | class wxButton : public wxControl { | |
54 | public: | |
55 | wxButton(wxWindow* parent, wxWindowID id, const wxString& label, | |
56 | const wxPoint& pos = wxPyDefaultPosition, | |
57 | const wxSize& size = wxPyDefaultSize, | |
58 | long style = 0, | |
59 | const wxValidator& validator = wxPyDefaultValidator, | |
60 | char* name = "button"); | |
61 | void SetDefault(); | |
62 | }; | |
63 | ||
64 | //---------------------------------------------------------------------- | |
65 | ||
66 | class wxBitmapButton : public wxButton { | |
67 | public: | |
68 | wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, | |
69 | const wxPoint& pos = wxPyDefaultPosition, | |
70 | const wxSize& size = wxPyDefaultSize, | |
71 | long style = wxBU_AUTODRAW, | |
72 | const wxValidator& validator = wxPyDefaultValidator, | |
73 | char* name = "button"); | |
74 | ||
fb5e0af0 RD |
75 | wxBitmap& GetBitmapLabel(); |
76 | #ifdef __WXMSW__ | |
7bf85405 RD |
77 | wxBitmap& GetBitmapDisabled(); |
78 | wxBitmap& GetBitmapFocus(); | |
7bf85405 RD |
79 | wxBitmap& GetBitmapSelected(); |
80 | void SetBitmapDisabled(const wxBitmap& bitmap); | |
81 | void SetBitmapFocus(const wxBitmap& bitmap); | |
7bf85405 | 82 | void SetBitmapSelected(const wxBitmap& bitmap); |
fb5e0af0 RD |
83 | #endif |
84 | void SetBitmapLabel(const wxBitmap& bitmap); | |
7bf85405 RD |
85 | |
86 | }; | |
87 | ||
88 | //---------------------------------------------------------------------- | |
89 | ||
90 | class wxCheckBox : public wxControl { | |
91 | public: | |
92 | wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
93 | const wxPoint& pos = wxPyDefaultPosition, | |
94 | const wxSize& size = wxPyDefaultSize, | |
95 | long style = 0, | |
96 | const wxValidator& val = wxPyDefaultValidator, | |
97 | char* name = "checkBox"); | |
98 | ||
99 | bool GetValue(); | |
100 | void SetValue(const bool state); | |
101 | }; | |
102 | ||
103 | //---------------------------------------------------------------------- | |
104 | ||
105 | class wxChoice : public wxControl { | |
106 | public: | |
107 | wxChoice(wxWindow *parent, wxWindowID id, | |
108 | const wxPoint& pos = wxPyDefaultPosition, | |
109 | const wxSize& size = wxPyDefaultSize, | |
110 | int LCOUNT=0, wxString* LIST=NULL, | |
111 | long style = 0, | |
112 | const wxValidator& validator = wxPyDefaultValidator, | |
113 | char* name = "choice"); | |
114 | ||
115 | void Append(const wxString& item); | |
116 | void Clear(); | |
117 | int FindString(const wxString& string); | |
118 | int GetColumns(); | |
119 | int GetSelection(); | |
120 | wxString GetString(const int n); | |
121 | wxString GetStringSelection(); | |
122 | int Number(); | |
123 | void SetColumns(const int n = 1); | |
124 | void SetSelection(const int n); | |
125 | void SetStringSelection(const wxString& string); | |
126 | }; | |
127 | ||
128 | //---------------------------------------------------------------------- | |
129 | ||
130 | class wxComboBox : public wxControl { | |
131 | public: | |
132 | wxComboBox(wxWindow* parent, wxWindowID id, char* value = "", | |
133 | const wxPoint& pos = wxPyDefaultPosition, | |
134 | const wxSize& size = wxPyDefaultSize, | |
135 | int LCOUNT=0, wxString* LIST=NULL, | |
136 | long style = 0, | |
137 | const wxValidator& validator = wxPyDefaultValidator, | |
138 | char* name = "comboBox"); | |
139 | ||
140 | void Append(const wxString& item); | |
141 | // TODO: void Append(const wxString& item, char* clientData); | |
142 | void Clear(); | |
143 | void Copy(); | |
144 | void Cut(); | |
145 | void Delete(int n); | |
146 | // NotMember??: void Deselect(int n); | |
147 | int FindString(const wxString& string); | |
148 | // TODO: char* GetClientData(const int n); | |
149 | long GetInsertionPoint(); | |
150 | long GetLastPosition(); | |
151 | int GetSelection(); | |
152 | wxString GetString(int n); | |
153 | wxString GetStringSelection(); | |
154 | wxString GetValue(); | |
155 | int Number(); | |
156 | void Paste(); | |
157 | void Replace(long from, long to, const wxString& text); | |
158 | void Remove(long from, long to); | |
159 | // TODO: void SetClientData(const int n, char* data); | |
160 | void SetInsertionPoint(long pos); | |
161 | void SetInsertionPointEnd(); | |
162 | void SetSelection(int n, bool select = TRUE); | |
163 | %name(SetMark)void SetSelection(long from, long to); | |
164 | void SetValue(const wxString& text); | |
165 | }; | |
166 | ||
167 | //---------------------------------------------------------------------- | |
168 | ||
169 | class wxGauge : public wxControl { | |
170 | public: | |
171 | wxGauge(wxWindow* parent, wxWindowID id, int range, | |
172 | const wxPoint& pos = wxPyDefaultPosition, | |
173 | const wxSize& size = wxPyDefaultSize, | |
174 | long style = wxGA_HORIZONTAL, | |
175 | const wxValidator& validator = wxPyDefaultValidator, | |
176 | char* name = "gauge"); | |
177 | ||
178 | int GetBezelFace(); | |
179 | int GetRange(); | |
180 | int GetShadowWidth(); | |
181 | int GetValue(); | |
182 | void SetBezelFace(int width); | |
183 | void SetRange(int range); | |
184 | void SetShadowWidth(int width); | |
185 | void SetValue(int pos); | |
186 | }; | |
187 | ||
188 | //---------------------------------------------------------------------- | |
189 | ||
190 | class wxStaticBox : public wxControl { | |
191 | public: | |
192 | wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label, | |
193 | const wxPoint& pos = wxPyDefaultPosition, | |
194 | const wxSize& size = wxPyDefaultSize, | |
195 | long style = 0, | |
196 | char* name = "staticBox"); | |
197 | }; | |
198 | ||
199 | ||
200 | //---------------------------------------------------------------------- | |
201 | ||
202 | class wxStaticText : public wxControl { | |
203 | public: | |
204 | wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, | |
205 | const wxPoint& pos = wxPyDefaultPosition, | |
206 | const wxSize& size = wxPyDefaultSize, | |
207 | long style = 0, | |
208 | char* name = "staticText"); | |
209 | ||
210 | wxString GetLabel(); | |
211 | void SetLabel(const wxString& label); | |
212 | }; | |
213 | ||
214 | //---------------------------------------------------------------------- | |
215 | ||
216 | class wxListBox : public wxControl { | |
217 | public: | |
218 | wxListBox(wxWindow* parent, wxWindowID id, | |
219 | const wxPoint& pos = wxPyDefaultPosition, | |
220 | const wxSize& size = wxPyDefaultSize, | |
221 | int LCOUNT, wxString* LIST = NULL, | |
222 | long style = 0, | |
223 | const wxValidator& validator = wxPyDefaultValidator, | |
224 | char* name = "listBox"); | |
225 | ||
226 | void Append(const wxString& item); | |
227 | // TODO: void Append(const wxString& item, char* clientData); | |
228 | void Clear(); | |
229 | void Delete(int n); | |
230 | void Deselect(int n); | |
231 | int FindString(const wxString& string); | |
232 | // TODO: char* GetClientData(const int n); | |
233 | int GetSelection(); | |
234 | // TODO: int GetSelections(int **selections); | |
235 | wxString GetString(int n); | |
236 | wxString GetStringSelection(); | |
237 | int Number(); | |
238 | bool Selected(const int n); | |
239 | void Set(int LCOUNT, wxString* LIST); | |
240 | // TODO: void SetClientData(const int n, char* data); | |
241 | void SetFirstItem(int n); | |
242 | %name(SetFirstItemStr)void SetFirstItem(const wxString& string); | |
243 | void SetSelection(int n, bool select = TRUE); | |
244 | void SetString(int n, const wxString& string); | |
245 | void SetStringSelection(const wxString& string, bool select = TRUE); | |
246 | }; | |
247 | ||
248 | ||
249 | //---------------------------------------------------------------------- | |
250 | ||
251 | class wxTextCtrl : public wxControl { | |
252 | public: | |
253 | wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "", | |
254 | const wxPoint& pos = wxPyDefaultPosition, | |
255 | const wxSize& size = wxPyDefaultSize, | |
256 | long style = 0, | |
257 | const wxValidator& validator = wxPyDefaultValidator, | |
258 | char* name = "text"); | |
259 | ||
260 | void Clear(); | |
261 | void Copy(); | |
262 | void Cut(); | |
263 | void DiscardEdits(); | |
264 | long GetInsertionPoint(); | |
265 | long GetLastPosition(); | |
fb5e0af0 | 266 | #ifdef __WXMSW__ |
7bf85405 RD |
267 | int GetLineLength(long lineNo); |
268 | wxString GetLineText(long lineNo); | |
269 | int GetNumberOfLines(); | |
fb5e0af0 | 270 | #endif |
7bf85405 RD |
271 | wxString GetValue(); |
272 | bool IsModified(); | |
273 | bool LoadFile(const wxString& filename); | |
274 | void Paste(); | |
fb5e0af0 | 275 | #ifdef __WXMSW__ |
7bf85405 | 276 | void PositionToXY(long pos, long *OUTPUT, long *OUTPUT); |
fb5e0af0 | 277 | #endif |
7bf85405 RD |
278 | void Remove(long from, long to); |
279 | void Replace(long from, long to, const wxString& value); | |
280 | bool SaveFile(const wxString& filename); | |
281 | void SetEditable(bool editable); | |
282 | void SetInsertionPoint(long pos); | |
283 | void SetInsertionPointEnd(); | |
284 | void SetSelection(long from, long to); | |
285 | void SetValue(const wxString& value); | |
286 | void ShowPosition(long pos); | |
287 | void WriteText(const wxString& text); | |
fb5e0af0 | 288 | #ifdef __WXMSW__ |
7bf85405 | 289 | long XYToPosition(long x, long y); |
fb5e0af0 | 290 | #endif |
7bf85405 RD |
291 | }; |
292 | ||
293 | //---------------------------------------------------------------------- | |
294 | ||
295 | class wxScrollBar : public wxControl { | |
296 | public: | |
297 | wxScrollBar(wxWindow* parent, wxWindowID id = -1, | |
298 | const wxPoint& pos = wxPyDefaultPosition, | |
299 | const wxSize& size = wxPyDefaultSize, | |
300 | long style = wxSB_HORIZONTAL, | |
301 | const wxValidator& validator = wxPyDefaultValidator, | |
302 | char* name = "scrollBar"); | |
303 | ||
304 | int GetRange(); | |
305 | int GetPageSize(); | |
306 | int GetPosition(); | |
307 | int GetThumbSize(); | |
308 | void SetPosition(int viewStart); | |
309 | void SetScrollbar(int position, int thumbSize, | |
310 | int range, int pageSize, | |
311 | bool refresh = TRUE); | |
312 | }; | |
313 | ||
314 | //---------------------------------------------------------------------- | |
315 | ||
fb5e0af0 | 316 | #ifdef __WXMSW__ |
7bf85405 RD |
317 | class wxSpinButton : public wxControl { |
318 | public: | |
319 | wxSpinButton(wxWindow* parent, wxWindowID id = -1, | |
320 | const wxPoint& pos = wxPyDefaultPosition, | |
321 | const wxSize& size = wxPyDefaultSize, | |
322 | long style = wxSP_HORIZONTAL, | |
323 | char* name = "spinButton"); | |
324 | ||
325 | int GetMax(); | |
326 | int GetMin(); | |
327 | int GetValue(); | |
328 | void SetRange(int min, int max); | |
329 | void SetValue(int value); | |
330 | }; | |
fb5e0af0 | 331 | #endif |
7bf85405 RD |
332 | |
333 | //---------------------------------------------------------------------- | |
334 | ||
335 | class wxStaticBitmap : public wxControl { | |
336 | public: | |
337 | wxStaticBitmap(wxWindow* parent, wxWindowID id, | |
338 | const wxBitmap& bitmap, | |
339 | const wxPoint& pos = wxPyDefaultPosition, | |
340 | const wxSize& size = wxPyDefaultSize, | |
341 | long style = 0, | |
342 | char* name = "staticBitmap"); | |
343 | ||
344 | wxBitmap& GetBitmap(); | |
345 | void SetBitmap(const wxBitmap& bitmap); | |
346 | }; | |
347 | ||
348 | //---------------------------------------------------------------------- | |
349 | ||
350 | class wxRadioBox : public wxControl { | |
351 | public: | |
352 | wxRadioBox(wxWindow* parent, wxWindowID id, | |
353 | const wxString& label, | |
354 | const wxPoint& point = wxPyDefaultPosition, | |
355 | const wxSize& size = wxPyDefaultSize, | |
356 | int LCOUNT = 0, wxString* LIST = NULL, | |
357 | int majorDimension = 0, | |
358 | long style = wxRA_HORIZONTAL, | |
359 | const wxValidator& validator = wxPyDefaultValidator, | |
360 | char* name = "radioBox"); | |
361 | ||
362 | %name(EnableBox)void Enable(bool enable); | |
363 | void Enable(int n, bool enable); | |
364 | int FindString(const wxString& string); | |
365 | %name(GetBoxLabel)wxString GetLabel(); | |
366 | wxString GetLabel(int n); | |
367 | int GetSelection(); | |
368 | wxString GetString(int n); | |
369 | wxString GetStringSelection(); | |
370 | int Number(); | |
371 | %name(SetBoxLabel)void SetLabel(const wxString& label); | |
372 | void SetLabel(int n, const wxString& label); | |
373 | void SetSelection(int n); | |
374 | void SetStringSelection(const wxString& string); | |
375 | void Show(bool show); | |
376 | %name(ShowItem)void Show(int item, bool show); | |
377 | }; | |
378 | ||
379 | //---------------------------------------------------------------------- | |
380 | ||
381 | class wxRadioButton : public wxControl { | |
382 | public: | |
383 | wxRadioButton(wxWindow* parent, wxWindowID id, | |
384 | const wxString& label, | |
385 | const wxPoint& pos = wxPyDefaultPosition, | |
386 | const wxSize& size = wxPyDefaultSize, | |
387 | long style = 0, | |
388 | const wxValidator& validator = wxPyDefaultValidator, | |
389 | char* name = "radioButton"); | |
390 | ||
391 | bool GetValue(); | |
392 | void SetValue(bool value); | |
393 | }; | |
394 | ||
395 | //---------------------------------------------------------------------- | |
396 | ||
397 | class wxSlider : public wxControl { | |
398 | public: | |
399 | wxSlider(wxWindow* parent, wxWindowID id, | |
400 | int value, int minValue, int maxValue, | |
401 | const wxPoint& point = wxPyDefaultPosition, | |
402 | const wxSize& size = wxPyDefaultSize, | |
403 | long style = wxSL_HORIZONTAL, | |
404 | const wxValidator& validator = wxPyDefaultValidator, | |
405 | char* name = "slider"); | |
406 | ||
407 | void ClearSel(); | |
408 | void ClearTicks(); | |
409 | int GetLineSize(); | |
410 | int GetMax(); | |
411 | int GetMin(); | |
412 | int GetPageSize(); | |
413 | int GetSelEnd(); | |
414 | int GetSelStart(); | |
415 | int GetThumbLength(); | |
416 | int GetTickFreq(); | |
417 | int GetValue(); | |
418 | void SetRange(int minValue, int maxValue); | |
419 | void SetTickFreq(int n, int pos); | |
420 | void SetLineSize(int lineSize); | |
421 | void SetPageSize(int pageSize); | |
422 | void SetSelection(int startPos, int endPos); | |
423 | void SetThumbLength(int len); | |
424 | void SetTick(int tickPos); | |
425 | void SetValue(int value); | |
426 | }; | |
427 | ||
428 | ||
429 | //---------------------------------------------------------------------- | |
430 | ||
431 | ||
432 | ///////////////////////////////////////////////////////////////////////////// | |
433 | // | |
434 | // $Log$ | |
fb5e0af0 RD |
435 | // Revision 1.3 1998/08/18 19:48:14 RD |
436 | // more wxGTK compatibility things. | |
437 | // | |
438 | // It builds now but there are serious runtime problems... | |
439 | // | |
03e9bead RD |
440 | // Revision 1.2 1998/08/15 07:36:28 RD |
441 | // - Moved the header in the .i files out of the code that gets put into | |
442 | // the .cpp files. It caused CVS conflicts because of the RCS ID being | |
443 | // different each time. | |
444 | // | |
445 | // - A few minor fixes. | |
446 | // | |
7bf85405 RD |
447 | // Revision 1.1 1998/08/09 08:25:49 RD |
448 | // Initial version | |
449 | // | |
450 | // | |
451 |