]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/controls.i
Tweaks needed to be able to build wxPython with wxGTK.
[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
7bf85405
RD
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
b8b8dda7 39%pragma(python) code = "import wx"
9c039d08 40
7bf85405
RD
41//----------------------------------------------------------------------
42
43%{
44wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
45%}
46
47//----------------------------------------------------------------------
48
49class wxControl : public wxWindow {
50public:
51 void Command(wxCommandEvent& event);
fb5e0af0 52 wxString GetLabel();
7bf85405
RD
53 void SetLabel(const wxString& label);
54};
55
56//----------------------------------------------------------------------
57
58class wxButton : public wxControl {
59public:
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");
9c039d08 66
b8b8dda7 67 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 68
7bf85405
RD
69 void SetDefault();
70};
71
72//----------------------------------------------------------------------
73
74class wxBitmapButton : public wxButton {
75public:
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
b8b8dda7 83 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 84
fb5e0af0
RD
85 wxBitmap& GetBitmapLabel();
86#ifdef __WXMSW__
7bf85405
RD
87 wxBitmap& GetBitmapDisabled();
88 wxBitmap& GetBitmapFocus();
7bf85405
RD
89 wxBitmap& GetBitmapSelected();
90 void SetBitmapDisabled(const wxBitmap& bitmap);
91 void SetBitmapFocus(const wxBitmap& bitmap);
7bf85405 92 void SetBitmapSelected(const wxBitmap& bitmap);
fb5e0af0
RD
93#endif
94 void SetBitmapLabel(const wxBitmap& bitmap);
7bf85405
RD
95
96};
97
98//----------------------------------------------------------------------
99
100class wxCheckBox : public wxControl {
101public:
102 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
103 const wxPoint& pos = wxPyDefaultPosition,
104 const wxSize& size = wxPyDefaultSize,
105 long style = 0,
106 const wxValidator& val = wxPyDefaultValidator,
107 char* name = "checkBox");
108
b8b8dda7 109 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 110
7bf85405
RD
111 bool GetValue();
112 void SetValue(const bool state);
113};
114
115//----------------------------------------------------------------------
116
117class wxChoice : public wxControl {
118public:
119 wxChoice(wxWindow *parent, wxWindowID id,
120 const wxPoint& pos = wxPyDefaultPosition,
121 const wxSize& size = wxPyDefaultSize,
122 int LCOUNT=0, wxString* LIST=NULL,
123 long style = 0,
124 const wxValidator& validator = wxPyDefaultValidator,
125 char* name = "choice");
126
b8b8dda7 127 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 128
7bf85405
RD
129 void Append(const wxString& item);
130 void Clear();
131 int FindString(const wxString& string);
132 int GetColumns();
133 int GetSelection();
134 wxString GetString(const int n);
135 wxString GetStringSelection();
136 int Number();
137 void SetColumns(const int n = 1);
138 void SetSelection(const int n);
139 void SetStringSelection(const wxString& string);
140};
141
142//----------------------------------------------------------------------
143
144class wxComboBox : public wxControl {
145public:
146 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
147 const wxPoint& pos = wxPyDefaultPosition,
148 const wxSize& size = wxPyDefaultSize,
149 int LCOUNT=0, wxString* LIST=NULL,
150 long style = 0,
151 const wxValidator& validator = wxPyDefaultValidator,
152 char* name = "comboBox");
153
b8b8dda7 154 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 155
7bf85405
RD
156 void Append(const wxString& item);
157 // TODO: void Append(const wxString& item, char* clientData);
158 void Clear();
159 void Copy();
160 void Cut();
161 void Delete(int n);
162 // NotMember??: void Deselect(int n);
163 int FindString(const wxString& string);
164 // TODO: char* GetClientData(const int n);
165 long GetInsertionPoint();
166 long GetLastPosition();
167 int GetSelection();
168 wxString GetString(int n);
169 wxString GetStringSelection();
170 wxString GetValue();
171 int Number();
172 void Paste();
173 void Replace(long from, long to, const wxString& text);
174 void Remove(long from, long to);
175 // TODO: void SetClientData(const int n, char* data);
176 void SetInsertionPoint(long pos);
177 void SetInsertionPointEnd();
178 void SetSelection(int n, bool select = TRUE);
179 %name(SetMark)void SetSelection(long from, long to);
180 void SetValue(const wxString& text);
181};
182
183//----------------------------------------------------------------------
184
185class wxGauge : public wxControl {
186public:
187 wxGauge(wxWindow* parent, wxWindowID id, int range,
188 const wxPoint& pos = wxPyDefaultPosition,
189 const wxSize& size = wxPyDefaultSize,
190 long style = wxGA_HORIZONTAL,
191 const wxValidator& validator = wxPyDefaultValidator,
192 char* name = "gauge");
193
b8b8dda7 194 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 195
7bf85405
RD
196 int GetBezelFace();
197 int GetRange();
198 int GetShadowWidth();
199 int GetValue();
200 void SetBezelFace(int width);
201 void SetRange(int range);
202 void SetShadowWidth(int width);
203 void SetValue(int pos);
204};
205
206//----------------------------------------------------------------------
207
208class wxStaticBox : public wxControl {
209public:
210 wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
211 const wxPoint& pos = wxPyDefaultPosition,
212 const wxSize& size = wxPyDefaultSize,
213 long style = 0,
214 char* name = "staticBox");
215};
216
217
218//----------------------------------------------------------------------
219
220class wxStaticText : public wxControl {
221public:
222 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
223 const wxPoint& pos = wxPyDefaultPosition,
224 const wxSize& size = wxPyDefaultSize,
225 long style = 0,
226 char* name = "staticText");
227
b8b8dda7 228 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 229
7bf85405
RD
230 wxString GetLabel();
231 void SetLabel(const wxString& label);
232};
233
234//----------------------------------------------------------------------
235
236class wxListBox : public wxControl {
237public:
238 wxListBox(wxWindow* parent, wxWindowID id,
239 const wxPoint& pos = wxPyDefaultPosition,
240 const wxSize& size = wxPyDefaultSize,
241 int LCOUNT, wxString* LIST = NULL,
242 long style = 0,
243 const wxValidator& validator = wxPyDefaultValidator,
244 char* name = "listBox");
245
b8b8dda7 246 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 247
7bf85405
RD
248 void Append(const wxString& item);
249 // TODO: void Append(const wxString& item, char* clientData);
250 void Clear();
251 void Delete(int n);
252 void Deselect(int n);
253 int FindString(const wxString& string);
254 // TODO: char* GetClientData(const int n);
255 int GetSelection();
256 // TODO: int GetSelections(int **selections);
257 wxString GetString(int n);
258 wxString GetStringSelection();
259 int Number();
260 bool Selected(const int n);
261 void Set(int LCOUNT, wxString* LIST);
262 // TODO: void SetClientData(const int n, char* data);
263 void SetFirstItem(int n);
264 %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
265 void SetSelection(int n, bool select = TRUE);
266 void SetString(int n, const wxString& string);
267 void SetStringSelection(const wxString& string, bool select = TRUE);
268};
269
270
9c039d08
RD
271//----------------------------------------------------------------------
272
273#ifdef __WXMSW__
274class wxCheckListBox : public wxListBox {
275public:
276 wxCheckListBox(wxWindow *parent, wxWindowID id,
277 const wxPoint& pos = wxPyDefaultPosition,
278 const wxSize& size = wxPyDefaultSize,
279 int LCOUNT = 0,
280 wxString* LIST = NULL,
281 long style = 0,
282 const wxValidator& validator = wxPyDefaultValidator,
283 char* name = "listBox");
284
b8b8dda7 285 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08
RD
286
287 bool IsChecked(int uiIndex);
288 void Check(int uiIndex, bool bCheck = TRUE);
289
290 int GetItemHeight();
291};
292#endif
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
7bf85405
RD
407 %name(EnableBox)void Enable(bool enable);
408 void Enable(int n, bool enable);
409 int FindString(const wxString& string);
b26e2dc4 410#ifdef __WXMSW__
7bf85405 411 %name(GetBoxLabel)wxString GetLabel();
b26e2dc4 412#endif
7bf85405
RD
413 wxString GetLabel(int n);
414 int GetSelection();
415 wxString GetString(int n);
416 wxString GetStringSelection();
417 int Number();
418 %name(SetBoxLabel)void SetLabel(const wxString& label);
419 void SetLabel(int n, const wxString& label);
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$
b8b8dda7
RD
486// Revision 1.8 1998/12/15 20:41:15 RD
487// Changed the import semantics from "from wxPython import *" to "from
488// wxPython.wx import *" This is for people who are worried about
489// namespace pollution, they can use "from wxPython import wx" and then
490// prefix all the wxPython identifiers with "wx."
491//
492// Added wxTaskbarIcon for wxMSW.
493//
494// Made the events work for wxGrid.
495//
496// Added wxConfig.
497//
498// Added wxMiniFrame for wxGTK, (untested.)
499//
500// Changed many of the args and return values that were pointers to gdi
501// objects to references to reflect changes in the wxWindows API.
502//
503// Other assorted fixes and additions.
504//
62bd0874
RD
505// Revision 1.7 1998/11/16 00:00:53 RD
506// Generic treectrl for wxPython/GTK compiles...
507//
faf3cb35
RD
508// Revision 1.6 1998/11/15 23:03:43 RD
509// Removing some ifdef's for wxGTK
510//
b26e2dc4
RD
511// Revision 1.5 1998/10/07 07:34:32 RD
512// Version 0.4.1 for wxGTK
513//
9c039d08 514// Revision 1.4 1998/10/02 06:40:35 RD
b26e2dc4 515//
9c039d08
RD
516// Version 0.4 of wxPython for MSW.
517//
fb5e0af0
RD
518// Revision 1.3 1998/08/18 19:48:14 RD
519// more wxGTK compatibility things.
520//
521// It builds now but there are serious runtime problems...
522//
03e9bead
RD
523// Revision 1.2 1998/08/15 07:36:28 RD
524// - Moved the header in the .i files out of the code that gets put into
525// the .cpp files. It caused CVS conflicts because of the RCS ID being
526// different each time.
527//
528// - A few minor fixes.
529//
7bf85405
RD
530// Revision 1.1 1998/08/09 08:25:49 RD
531// Initial version
532//
533//
534