]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/controls.i
fixes for GetReturnCode/SetReturnCode
[wxWidgets.git] / utils / wxPython / src / controls.i
CommitLineData
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>
62bd0874 18#include <wx/spinbutt.h>
cf694132 19#include <wx/dynarray.h>
fb5e0af0
RD
20
21#ifdef __WXMSW__
9c039d08
RD
22#if wxUSE_OWNER_DRAWN
23#include <wx/checklst.h>
24#endif
fb5e0af0 25#endif
c95e68d8
RD
26
27#ifdef __WXGTK__
28#include <wx/checklst.h>
29#endif
7bf85405
RD
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
b8b8dda7 44%pragma(python) code = "import wx"
9c039d08 45
7bf85405
RD
46//----------------------------------------------------------------------
47
48%{
49wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
50%}
51
52//----------------------------------------------------------------------
53
54class wxControl : public wxWindow {
55public:
56 void Command(wxCommandEvent& event);
fb5e0af0 57 wxString GetLabel();
7bf85405
RD
58 void SetLabel(const wxString& label);
59};
60
61//----------------------------------------------------------------------
62
63class wxButton : public wxControl {
64public:
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");
9c039d08 71
b8b8dda7 72 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 73
7bf85405
RD
74 void SetDefault();
75};
76
77//----------------------------------------------------------------------
78
79class wxBitmapButton : public wxButton {
80public:
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
b8b8dda7 88 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 89
fb5e0af0 90 wxBitmap& GetBitmapLabel();
7bf85405
RD
91 wxBitmap& GetBitmapDisabled();
92 wxBitmap& GetBitmapFocus();
7bf85405
RD
93 wxBitmap& GetBitmapSelected();
94 void SetBitmapDisabled(const wxBitmap& bitmap);
95 void SetBitmapFocus(const wxBitmap& bitmap);
7bf85405 96 void SetBitmapSelected(const wxBitmap& bitmap);
fb5e0af0 97 void SetBitmapLabel(const wxBitmap& bitmap);
7bf85405
RD
98
99};
100
101//----------------------------------------------------------------------
102
103class wxCheckBox : public wxControl {
104public:
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
b8b8dda7 112 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 113
7bf85405
RD
114 bool GetValue();
115 void SetValue(const bool state);
116};
117
118//----------------------------------------------------------------------
119
120class wxChoice : public wxControl {
121public:
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
b8b8dda7 130 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 131
7bf85405
RD
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
147class wxComboBox : public wxControl {
148public:
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
b8b8dda7 157 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 158
7bf85405
RD
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
188class wxGauge : public wxControl {
189public:
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
b8b8dda7 197 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 198
7bf85405
RD
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
211class wxStaticBox : public wxControl {
212public:
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
223class wxStaticText : public wxControl {
224public:
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
b8b8dda7 231 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 232
7bf85405
RD
233 wxString GetLabel();
234 void SetLabel(const wxString& label);
235};
236
237//----------------------------------------------------------------------
238
239class wxListBox : public wxControl {
240public:
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
b8b8dda7 249 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 250
7bf85405
RD
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();
cf694132
RD
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
7bf85405
RD
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
9c039d08
RD
287//----------------------------------------------------------------------
288
9c039d08
RD
289class wxCheckListBox : public wxListBox {
290public:
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
b8b8dda7 300 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08
RD
301
302 bool IsChecked(int uiIndex);
303 void Check(int uiIndex, bool bCheck = TRUE);
304
305 int GetItemHeight();
306};
9c039d08 307
7bf85405
RD
308//----------------------------------------------------------------------
309
310class wxTextCtrl : public wxControl {
311public:
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
b8b8dda7 319 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 320
7bf85405
RD
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);
cf694132 345 void AppendText(const wxString& text);
7bf85405 346 long XYToPosition(long x, long y);
d403febc
RD
347
348 bool CanCopy();
349 bool CanCut();
350 bool CanPaste();
351 bool CanRedo();
352 bool CanUndo();
353 void GetSelection(long* OUTPUT, long* OUTPUT);
354 bool IsEditable();
7bf85405
RD
355};
356
357//----------------------------------------------------------------------
358
359class wxScrollBar : public wxControl {
360public:
361 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
362 const wxPoint& pos = wxPyDefaultPosition,
363 const wxSize& size = wxPyDefaultSize,
364 long style = wxSB_HORIZONTAL,
365 const wxValidator& validator = wxPyDefaultValidator,
366 char* name = "scrollBar");
367
b8b8dda7 368 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 369
7bf85405
RD
370 int GetRange();
371 int GetPageSize();
b8b8dda7 372 int GetThumbPosition();
7bf85405 373 int GetThumbSize();
b8b8dda7 374 void SetThumbPosition(int viewStart);
7bf85405
RD
375 void SetScrollbar(int position, int thumbSize,
376 int range, int pageSize,
377 bool refresh = TRUE);
378};
379
380//----------------------------------------------------------------------
381
382class wxSpinButton : public wxControl {
383public:
384 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
385 const wxPoint& pos = wxPyDefaultPosition,
386 const wxSize& size = wxPyDefaultSize,
387 long style = wxSP_HORIZONTAL,
388 char* name = "spinButton");
389
390 int GetMax();
391 int GetMin();
392 int GetValue();
393 void SetRange(int min, int max);
394 void SetValue(int value);
395};
396
397//----------------------------------------------------------------------
398
399class wxStaticBitmap : public wxControl {
400public:
401 wxStaticBitmap(wxWindow* parent, wxWindowID id,
402 const wxBitmap& bitmap,
403 const wxPoint& pos = wxPyDefaultPosition,
404 const wxSize& size = wxPyDefaultSize,
405 long style = 0,
406 char* name = "staticBitmap");
407
b8b8dda7 408 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 409
cf694132 410 const wxBitmap& GetBitmap();
7bf85405
RD
411 void SetBitmap(const wxBitmap& bitmap);
412};
413
414//----------------------------------------------------------------------
415
416class wxRadioBox : public wxControl {
417public:
418 wxRadioBox(wxWindow* parent, wxWindowID id,
419 const wxString& label,
420 const wxPoint& point = wxPyDefaultPosition,
421 const wxSize& size = wxPyDefaultSize,
422 int LCOUNT = 0, wxString* LIST = NULL,
423 int majorDimension = 0,
424 long style = wxRA_HORIZONTAL,
425 const wxValidator& validator = wxPyDefaultValidator,
426 char* name = "radioBox");
427
b8b8dda7 428 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 429
0699c864
RD
430 void Enable(bool enable);
431 %name(EnableItem)void Enable(int n, bool enable);
7bf85405 432 int FindString(const wxString& string);
b26e2dc4 433#ifdef __WXMSW__
0699c864 434 wxString GetLabel();
b26e2dc4 435#endif
0699c864 436 %name(GetItemLabel)wxString GetLabel(int n);
7bf85405
RD
437 int GetSelection();
438 wxString GetString(int n);
439 wxString GetStringSelection();
440 int Number();
0699c864
RD
441 void SetLabel(const wxString& label);
442 %name(SetItemLabel)void SetLabel(int n, const wxString& label);
7bf85405
RD
443 void SetSelection(int n);
444 void SetStringSelection(const wxString& string);
445 void Show(bool show);
446 %name(ShowItem)void Show(int item, bool show);
447};
448
449//----------------------------------------------------------------------
450
451class wxRadioButton : public wxControl {
452public:
453 wxRadioButton(wxWindow* parent, wxWindowID id,
454 const wxString& label,
455 const wxPoint& pos = wxPyDefaultPosition,
456 const wxSize& size = wxPyDefaultSize,
457 long style = 0,
458 const wxValidator& validator = wxPyDefaultValidator,
459 char* name = "radioButton");
460
b8b8dda7 461 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 462
7bf85405
RD
463 bool GetValue();
464 void SetValue(bool value);
465};
466
467//----------------------------------------------------------------------
468
469class wxSlider : public wxControl {
470public:
471 wxSlider(wxWindow* parent, wxWindowID id,
472 int value, int minValue, int maxValue,
473 const wxPoint& point = wxPyDefaultPosition,
474 const wxSize& size = wxPyDefaultSize,
475 long style = wxSL_HORIZONTAL,
476 const wxValidator& validator = wxPyDefaultValidator,
477 char* name = "slider");
478
b8b8dda7 479 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 480
7bf85405
RD
481 void ClearSel();
482 void ClearTicks();
483 int GetLineSize();
484 int GetMax();
485 int GetMin();
486 int GetPageSize();
487 int GetSelEnd();
488 int GetSelStart();
489 int GetThumbLength();
490 int GetTickFreq();
491 int GetValue();
492 void SetRange(int minValue, int maxValue);
493 void SetTickFreq(int n, int pos);
494 void SetLineSize(int lineSize);
495 void SetPageSize(int pageSize);
496 void SetSelection(int startPos, int endPos);
497 void SetThumbLength(int len);
498 void SetTick(int tickPos);
499 void SetValue(int value);
500};
501
502
503//----------------------------------------------------------------------
504
505
506/////////////////////////////////////////////////////////////////////////////
507//
508// $Log$
d403febc
RD
509// Revision 1.13 1999/04/30 21:13:43 RD
510// wxPython 2.0b9, first phase (win32)
511// Added gobs of stuff, see wxPython/README.txt for details
512//
cf694132 513// Revision 1.12 1999/04/30 03:29:18 RD
d403febc 514//
cf694132
RD
515// wxPython 2.0b9, first phase (win32)
516// Added gobs of stuff, see wxPython/README.txt for details
517//
518// Revision 1.11.4.1 1999/03/27 23:29:14 RD
519//
520// wxPython 2.0b8
521// Python thread support
522// various minor additions
523// various minor fixes
524//
0699c864 525// Revision 1.11 1999/02/25 07:08:30 RD
cf694132 526//
0699c864
RD
527// wxPython version 2.0b5
528//
c95e68d8 529// Revision 1.10 1998/12/17 17:52:19 RD
0699c864 530//
c95e68d8
RD
531// wxPython 0.5.2
532// Minor fixes and SWIG code generation for RR's changes. MSW and GTK
533// versions are much closer now!
534//
4f22cf8d 535// Revision 1.9 1998/12/17 14:07:29 RR
c95e68d8 536//
4f22cf8d
RR
537// Removed minor differences between wxMSW and wxGTK
538//
b8b8dda7
RD
539// Revision 1.8 1998/12/15 20:41:15 RD
540// Changed the import semantics from "from wxPython import *" to "from
541// wxPython.wx import *" This is for people who are worried about
542// namespace pollution, they can use "from wxPython import wx" and then
543// prefix all the wxPython identifiers with "wx."
544//
545// Added wxTaskbarIcon for wxMSW.
546//
547// Made the events work for wxGrid.
548//
549// Added wxConfig.
550//
551// Added wxMiniFrame for wxGTK, (untested.)
552//
553// Changed many of the args and return values that were pointers to gdi
554// objects to references to reflect changes in the wxWindows API.
555//
556// Other assorted fixes and additions.
557//
62bd0874
RD
558// Revision 1.7 1998/11/16 00:00:53 RD
559// Generic treectrl for wxPython/GTK compiles...
560//
faf3cb35
RD
561// Revision 1.6 1998/11/15 23:03:43 RD
562// Removing some ifdef's for wxGTK
563//
b26e2dc4
RD
564// Revision 1.5 1998/10/07 07:34:32 RD
565// Version 0.4.1 for wxGTK
566//
9c039d08 567// Revision 1.4 1998/10/02 06:40:35 RD
b26e2dc4 568//
9c039d08
RD
569// Version 0.4 of wxPython for MSW.
570//
fb5e0af0
RD
571// Revision 1.3 1998/08/18 19:48:14 RD
572// more wxGTK compatibility things.
573//
574// It builds now but there are serious runtime problems...
575//
03e9bead
RD
576// Revision 1.2 1998/08/15 07:36:28 RD
577// - Moved the header in the .i files out of the code that gets put into
578// the .cpp files. It caused CVS conflicts because of the RCS ID being
579// different each time.
580//
581// - A few minor fixes.
582//
7bf85405
RD
583// Revision 1.1 1998/08/09 08:25:49 RD
584// Initial version
585//
586//
587