]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/controls.i
jconfig.h uses configures results
[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
RD
346 long XYToPosition(long x, long y);
347};
348
349//----------------------------------------------------------------------
350
351class wxScrollBar : public wxControl {
352public:
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
b8b8dda7 360 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 361
7bf85405
RD
362 int GetRange();
363 int GetPageSize();
b8b8dda7 364 int GetThumbPosition();
7bf85405 365 int GetThumbSize();
b8b8dda7 366 void SetThumbPosition(int viewStart);
7bf85405
RD
367 void SetScrollbar(int position, int thumbSize,
368 int range, int pageSize,
369 bool refresh = TRUE);
370};
371
372//----------------------------------------------------------------------
373
374class wxSpinButton : public wxControl {
375public:
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
391class wxStaticBitmap : public wxControl {
392public:
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
b8b8dda7 400 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 401
cf694132 402 const wxBitmap& GetBitmap();
7bf85405
RD
403 void SetBitmap(const wxBitmap& bitmap);
404};
405
406//----------------------------------------------------------------------
407
408class wxRadioBox : public wxControl {
409public:
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
b8b8dda7 420 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 421
0699c864
RD
422 void Enable(bool enable);
423 %name(EnableItem)void Enable(int n, bool enable);
7bf85405 424 int FindString(const wxString& string);
b26e2dc4 425#ifdef __WXMSW__
0699c864 426 wxString GetLabel();
b26e2dc4 427#endif
0699c864 428 %name(GetItemLabel)wxString GetLabel(int n);
7bf85405
RD
429 int GetSelection();
430 wxString GetString(int n);
431 wxString GetStringSelection();
432 int Number();
0699c864
RD
433 void SetLabel(const wxString& label);
434 %name(SetItemLabel)void SetLabel(int n, const wxString& label);
7bf85405
RD
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
443class wxRadioButton : public wxControl {
444public:
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
b8b8dda7 453 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 454
7bf85405
RD
455 bool GetValue();
456 void SetValue(bool value);
457};
458
459//----------------------------------------------------------------------
460
461class wxSlider : public wxControl {
462public:
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
b8b8dda7 471 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 472
7bf85405
RD
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$
cf694132
RD
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//
0699c864 512// Revision 1.11 1999/02/25 07:08:30 RD
cf694132 513//
0699c864
RD
514// wxPython version 2.0b5
515//
c95e68d8 516// Revision 1.10 1998/12/17 17:52:19 RD
0699c864 517//
c95e68d8
RD
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//
4f22cf8d 522// Revision 1.9 1998/12/17 14:07:29 RR
c95e68d8 523//
4f22cf8d
RR
524// Removed minor differences between wxMSW and wxGTK
525//
b8b8dda7
RD
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//
62bd0874
RD
545// Revision 1.7 1998/11/16 00:00:53 RD
546// Generic treectrl for wxPython/GTK compiles...
547//
faf3cb35
RD
548// Revision 1.6 1998/11/15 23:03:43 RD
549// Removing some ifdef's for wxGTK
550//
b26e2dc4
RD
551// Revision 1.5 1998/10/07 07:34:32 RD
552// Version 0.4.1 for wxGTK
553//
9c039d08 554// Revision 1.4 1998/10/02 06:40:35 RD
b26e2dc4 555//
9c039d08
RD
556// Version 0.4 of wxPython for MSW.
557//
fb5e0af0
RD
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//
03e9bead
RD
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//
7bf85405
RD
570// Revision 1.1 1998/08/09 08:25:49 RD
571// Initial version
572//
573//
574