]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/controls.i
Removed minor differences between wxMSW and wxGTK
[wxWidgets.git] / utils / wxPython / src / controls.i
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
13 %module controls
14
15 %{
16 #include "helpers.h"
17 #include <wx/slider.h>
18 #include <wx/spinbutt.h>
19
20 #ifdef __WXMSW__
21 #if wxUSE_OWNER_DRAWN
22 #include <wx/checklst.h>
23 #endif
24 #endif
25 %}
26
27 //----------------------------------------------------------------------
28
29 %include typemaps.i
30 %include my_typemaps.i
31
32 // Import some definitions of other classes, etc.
33 %import _defs.i
34 %import misc.i
35 %import windows.i
36 %import gdi.i
37 %import events.i
38
39 %pragma(python) code = "import wx"
40
41 //----------------------------------------------------------------------
42
43 %{
44 wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
45 %}
46
47 //----------------------------------------------------------------------
48
49 class wxControl : public wxWindow {
50 public:
51 void Command(wxCommandEvent& event);
52 wxString GetLabel();
53 void SetLabel(const wxString& label);
54 };
55
56 //----------------------------------------------------------------------
57
58 class wxButton : public wxControl {
59 public:
60 wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
61 const wxPoint& pos = wxPyDefaultPosition,
62 const wxSize& size = wxPyDefaultSize,
63 long style = 0,
64 const wxValidator& validator = wxPyDefaultValidator,
65 char* name = "button");
66
67 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
68
69 void SetDefault();
70 };
71
72 //----------------------------------------------------------------------
73
74 class wxBitmapButton : public wxButton {
75 public:
76 wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
77 const wxPoint& pos = wxPyDefaultPosition,
78 const wxSize& size = wxPyDefaultSize,
79 long style = wxBU_AUTODRAW,
80 const wxValidator& validator = wxPyDefaultValidator,
81 char* name = "button");
82
83 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
84
85 wxBitmap& GetBitmapLabel();
86 wxBitmap& GetBitmapDisabled();
87 wxBitmap& GetBitmapFocus();
88 wxBitmap& GetBitmapSelected();
89 void SetBitmapDisabled(const wxBitmap& bitmap);
90 void SetBitmapFocus(const wxBitmap& bitmap);
91 void SetBitmapSelected(const wxBitmap& bitmap);
92 void SetBitmapLabel(const wxBitmap& bitmap);
93
94 };
95
96 //----------------------------------------------------------------------
97
98 class wxCheckBox : public wxControl {
99 public:
100 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
101 const wxPoint& pos = wxPyDefaultPosition,
102 const wxSize& size = wxPyDefaultSize,
103 long style = 0,
104 const wxValidator& val = wxPyDefaultValidator,
105 char* name = "checkBox");
106
107 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
108
109 bool GetValue();
110 void SetValue(const bool state);
111 };
112
113 //----------------------------------------------------------------------
114
115 class wxChoice : public wxControl {
116 public:
117 wxChoice(wxWindow *parent, wxWindowID id,
118 const wxPoint& pos = wxPyDefaultPosition,
119 const wxSize& size = wxPyDefaultSize,
120 int LCOUNT=0, wxString* LIST=NULL,
121 long style = 0,
122 const wxValidator& validator = wxPyDefaultValidator,
123 char* name = "choice");
124
125 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
126
127 void Append(const wxString& item);
128 void Clear();
129 int FindString(const wxString& string);
130 int GetColumns();
131 int GetSelection();
132 wxString GetString(const int n);
133 wxString GetStringSelection();
134 int Number();
135 void SetColumns(const int n = 1);
136 void SetSelection(const int n);
137 void SetStringSelection(const wxString& string);
138 };
139
140 //----------------------------------------------------------------------
141
142 class wxComboBox : public wxControl {
143 public:
144 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
145 const wxPoint& pos = wxPyDefaultPosition,
146 const wxSize& size = wxPyDefaultSize,
147 int LCOUNT=0, wxString* LIST=NULL,
148 long style = 0,
149 const wxValidator& validator = wxPyDefaultValidator,
150 char* name = "comboBox");
151
152 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
153
154 void Append(const wxString& item);
155 // TODO: void Append(const wxString& item, char* clientData);
156 void Clear();
157 void Copy();
158 void Cut();
159 void Delete(int n);
160 // NotMember??: void Deselect(int n);
161 int FindString(const wxString& string);
162 // TODO: char* GetClientData(const int n);
163 long GetInsertionPoint();
164 long GetLastPosition();
165 int GetSelection();
166 wxString GetString(int n);
167 wxString GetStringSelection();
168 wxString GetValue();
169 int Number();
170 void Paste();
171 void Replace(long from, long to, const wxString& text);
172 void Remove(long from, long to);
173 // TODO: void SetClientData(const int n, char* data);
174 void SetInsertionPoint(long pos);
175 void SetInsertionPointEnd();
176 void SetSelection(int n, bool select = TRUE);
177 %name(SetMark)void SetSelection(long from, long to);
178 void SetValue(const wxString& text);
179 };
180
181 //----------------------------------------------------------------------
182
183 class wxGauge : public wxControl {
184 public:
185 wxGauge(wxWindow* parent, wxWindowID id, int range,
186 const wxPoint& pos = wxPyDefaultPosition,
187 const wxSize& size = wxPyDefaultSize,
188 long style = wxGA_HORIZONTAL,
189 const wxValidator& validator = wxPyDefaultValidator,
190 char* name = "gauge");
191
192 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
193
194 int GetBezelFace();
195 int GetRange();
196 int GetShadowWidth();
197 int GetValue();
198 void SetBezelFace(int width);
199 void SetRange(int range);
200 void SetShadowWidth(int width);
201 void SetValue(int pos);
202 };
203
204 //----------------------------------------------------------------------
205
206 class wxStaticBox : public wxControl {
207 public:
208 wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
209 const wxPoint& pos = wxPyDefaultPosition,
210 const wxSize& size = wxPyDefaultSize,
211 long style = 0,
212 char* name = "staticBox");
213 };
214
215
216 //----------------------------------------------------------------------
217
218 class wxStaticText : public wxControl {
219 public:
220 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
221 const wxPoint& pos = wxPyDefaultPosition,
222 const wxSize& size = wxPyDefaultSize,
223 long style = 0,
224 char* name = "staticText");
225
226 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
227
228 wxString GetLabel();
229 void SetLabel(const wxString& label);
230 };
231
232 //----------------------------------------------------------------------
233
234 class wxListBox : public wxControl {
235 public:
236 wxListBox(wxWindow* parent, wxWindowID id,
237 const wxPoint& pos = wxPyDefaultPosition,
238 const wxSize& size = wxPyDefaultSize,
239 int LCOUNT, wxString* LIST = NULL,
240 long style = 0,
241 const wxValidator& validator = wxPyDefaultValidator,
242 char* name = "listBox");
243
244 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
245
246 void Append(const wxString& item);
247 // TODO: void Append(const wxString& item, char* clientData);
248 void Clear();
249 void Delete(int n);
250 void Deselect(int n);
251 int FindString(const wxString& string);
252 // TODO: char* GetClientData(const int n);
253 int GetSelection();
254 // TODO: int GetSelections(int **selections);
255 wxString GetString(int n);
256 wxString GetStringSelection();
257 int Number();
258 bool Selected(const int n);
259 void Set(int LCOUNT, wxString* LIST);
260 // TODO: void SetClientData(const int n, char* data);
261 void SetFirstItem(int n);
262 %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
263 void SetSelection(int n, bool select = TRUE);
264 void SetString(int n, const wxString& string);
265 void SetStringSelection(const wxString& string, bool select = TRUE);
266 };
267
268
269 //----------------------------------------------------------------------
270
271 class wxCheckListBox : public wxListBox {
272 public:
273 wxCheckListBox(wxWindow *parent, wxWindowID id,
274 const wxPoint& pos = wxPyDefaultPosition,
275 const wxSize& size = wxPyDefaultSize,
276 int LCOUNT = 0,
277 wxString* LIST = NULL,
278 long style = 0,
279 const wxValidator& validator = wxPyDefaultValidator,
280 char* name = "listBox");
281
282 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
283
284 bool IsChecked(int uiIndex);
285 void Check(int uiIndex, bool bCheck = TRUE);
286
287 int GetItemHeight();
288 };
289
290 //----------------------------------------------------------------------
291
292 class wxTextCtrl : public wxControl {
293 public:
294 wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
295 const wxPoint& pos = wxPyDefaultPosition,
296 const wxSize& size = wxPyDefaultSize,
297 long style = 0,
298 const wxValidator& validator = wxPyDefaultValidator,
299 char* name = "text");
300
301 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
302
303 void Clear();
304 void Copy();
305 void Cut();
306 void DiscardEdits();
307 long GetInsertionPoint();
308 long GetLastPosition();
309 int GetLineLength(long lineNo);
310 wxString GetLineText(long lineNo);
311 int GetNumberOfLines();
312 wxString GetValue();
313 bool IsModified();
314 bool LoadFile(const wxString& filename);
315 void Paste();
316 void PositionToXY(long pos, long *OUTPUT, long *OUTPUT);
317 void Remove(long from, long to);
318 void Replace(long from, long to, const wxString& value);
319 bool SaveFile(const wxString& filename);
320 void SetEditable(bool editable);
321 void SetInsertionPoint(long pos);
322 void SetInsertionPointEnd();
323 void SetSelection(long from, long to);
324 void SetValue(const wxString& value);
325 void ShowPosition(long pos);
326 void WriteText(const wxString& text);
327 long XYToPosition(long x, long y);
328 };
329
330 //----------------------------------------------------------------------
331
332 class wxScrollBar : public wxControl {
333 public:
334 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
335 const wxPoint& pos = wxPyDefaultPosition,
336 const wxSize& size = wxPyDefaultSize,
337 long style = wxSB_HORIZONTAL,
338 const wxValidator& validator = wxPyDefaultValidator,
339 char* name = "scrollBar");
340
341 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
342
343 int GetRange();
344 int GetPageSize();
345 int GetThumbPosition();
346 int GetThumbSize();
347 void SetThumbPosition(int viewStart);
348 void SetScrollbar(int position, int thumbSize,
349 int range, int pageSize,
350 bool refresh = TRUE);
351 };
352
353 //----------------------------------------------------------------------
354
355 class wxSpinButton : public wxControl {
356 public:
357 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
358 const wxPoint& pos = wxPyDefaultPosition,
359 const wxSize& size = wxPyDefaultSize,
360 long style = wxSP_HORIZONTAL,
361 char* name = "spinButton");
362
363 int GetMax();
364 int GetMin();
365 int GetValue();
366 void SetRange(int min, int max);
367 void SetValue(int value);
368 };
369
370 //----------------------------------------------------------------------
371
372 class wxStaticBitmap : public wxControl {
373 public:
374 wxStaticBitmap(wxWindow* parent, wxWindowID id,
375 const wxBitmap& bitmap,
376 const wxPoint& pos = wxPyDefaultPosition,
377 const wxSize& size = wxPyDefaultSize,
378 long style = 0,
379 char* name = "staticBitmap");
380
381 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
382
383 wxBitmap& GetBitmap();
384 void SetBitmap(const wxBitmap& bitmap);
385 };
386
387 //----------------------------------------------------------------------
388
389 class wxRadioBox : public wxControl {
390 public:
391 wxRadioBox(wxWindow* parent, wxWindowID id,
392 const wxString& label,
393 const wxPoint& point = wxPyDefaultPosition,
394 const wxSize& size = wxPyDefaultSize,
395 int LCOUNT = 0, wxString* LIST = NULL,
396 int majorDimension = 0,
397 long style = wxRA_HORIZONTAL,
398 const wxValidator& validator = wxPyDefaultValidator,
399 char* name = "radioBox");
400
401 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
402
403 %name(EnableBox)void Enable(bool enable);
404 void Enable(int n, bool enable);
405 int FindString(const wxString& string);
406 #ifdef __WXMSW__
407 %name(GetBoxLabel)wxString GetLabel();
408 #endif
409 wxString GetLabel(int n);
410 int GetSelection();
411 wxString GetString(int n);
412 wxString GetStringSelection();
413 int Number();
414 %name(SetBoxLabel)void SetLabel(const wxString& label);
415 void SetLabel(int n, const wxString& label);
416 void SetSelection(int n);
417 void SetStringSelection(const wxString& string);
418 void Show(bool show);
419 %name(ShowItem)void Show(int item, bool show);
420 };
421
422 //----------------------------------------------------------------------
423
424 class wxRadioButton : public wxControl {
425 public:
426 wxRadioButton(wxWindow* parent, wxWindowID id,
427 const wxString& label,
428 const wxPoint& pos = wxPyDefaultPosition,
429 const wxSize& size = wxPyDefaultSize,
430 long style = 0,
431 const wxValidator& validator = wxPyDefaultValidator,
432 char* name = "radioButton");
433
434 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
435
436 bool GetValue();
437 void SetValue(bool value);
438 };
439
440 //----------------------------------------------------------------------
441
442 class wxSlider : public wxControl {
443 public:
444 wxSlider(wxWindow* parent, wxWindowID id,
445 int value, int minValue, int maxValue,
446 const wxPoint& point = wxPyDefaultPosition,
447 const wxSize& size = wxPyDefaultSize,
448 long style = wxSL_HORIZONTAL,
449 const wxValidator& validator = wxPyDefaultValidator,
450 char* name = "slider");
451
452 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
453
454 void ClearSel();
455 void ClearTicks();
456 int GetLineSize();
457 int GetMax();
458 int GetMin();
459 int GetPageSize();
460 int GetSelEnd();
461 int GetSelStart();
462 int GetThumbLength();
463 int GetTickFreq();
464 int GetValue();
465 void SetRange(int minValue, int maxValue);
466 void SetTickFreq(int n, int pos);
467 void SetLineSize(int lineSize);
468 void SetPageSize(int pageSize);
469 void SetSelection(int startPos, int endPos);
470 void SetThumbLength(int len);
471 void SetTick(int tickPos);
472 void SetValue(int value);
473 };
474
475
476 //----------------------------------------------------------------------
477
478
479 /////////////////////////////////////////////////////////////////////////////
480 //
481 // $Log$
482 // Revision 1.9 1998/12/17 14:07:29 RR
483 // Removed minor differences between wxMSW and wxGTK
484 //
485 // Revision 1.8 1998/12/15 20:41:15 RD
486 // Changed the import semantics from "from wxPython import *" to "from
487 // wxPython.wx import *" This is for people who are worried about
488 // namespace pollution, they can use "from wxPython import wx" and then
489 // prefix all the wxPython identifiers with "wx."
490 //
491 // Added wxTaskbarIcon for wxMSW.
492 //
493 // Made the events work for wxGrid.
494 //
495 // Added wxConfig.
496 //
497 // Added wxMiniFrame for wxGTK, (untested.)
498 //
499 // Changed many of the args and return values that were pointers to gdi
500 // objects to references to reflect changes in the wxWindows API.
501 //
502 // Other assorted fixes and additions.
503 //
504 // Revision 1.7 1998/11/16 00:00:53 RD
505 // Generic treectrl for wxPython/GTK compiles...
506 //
507 // Revision 1.6 1998/11/15 23:03:43 RD
508 // Removing some ifdef's for wxGTK
509 //
510 // Revision 1.5 1998/10/07 07:34:32 RD
511 // Version 0.4.1 for wxGTK
512 //
513 // Revision 1.4 1998/10/02 06:40:35 RD
514 //
515 // Version 0.4 of wxPython for MSW.
516 //
517 // Revision 1.3 1998/08/18 19:48:14 RD
518 // more wxGTK compatibility things.
519 //
520 // It builds now but there are serious runtime problems...
521 //
522 // Revision 1.2 1998/08/15 07:36:28 RD
523 // - Moved the header in the .i files out of the code that gets put into
524 // the .cpp files. It caused CVS conflicts because of the RCS ID being
525 // different each time.
526 //
527 // - A few minor fixes.
528 //
529 // Revision 1.1 1998/08/09 08:25:49 RD
530 // Initial version
531 //
532 //
533