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