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