]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/controls.i
Additions for wxTreeCtrl
[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
19 #ifdef __WXMSW__
20 #include <wx/spinbutt.h>
21 #if wxUSE_OWNER_DRAWN
22 #include <wx/checklst.h>
23 #endif
24 #endif
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
39 %pragma(python) code = "import wxp"
40
41 //----------------------------------------------------------------------
42
43 %{
44 wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
45 %}
46
47 //----------------------------------------------------------------------
48
49 class wxControl : public wxWindow {
50 public:
51 void Command(wxCommandEvent& event);
52 wxString GetLabel();
53 void SetLabel(const wxString& label);
54 };
55
56 //----------------------------------------------------------------------
57
58 class wxButton : public wxControl {
59 public:
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");
66
67 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
68
69 void SetDefault();
70 };
71
72 //----------------------------------------------------------------------
73
74 class wxBitmapButton : public wxButton {
75 public:
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
83 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
84
85 wxBitmap& GetBitmapLabel();
86 #ifdef __WXMSW__
87 wxBitmap& GetBitmapDisabled();
88 wxBitmap& GetBitmapFocus();
89 wxBitmap& GetBitmapSelected();
90 void SetBitmapDisabled(const wxBitmap& bitmap);
91 void SetBitmapFocus(const wxBitmap& bitmap);
92 void SetBitmapSelected(const wxBitmap& bitmap);
93 #endif
94 void SetBitmapLabel(const wxBitmap& bitmap);
95
96 };
97
98 //----------------------------------------------------------------------
99
100 class wxCheckBox : public wxControl {
101 public:
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
109 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
110
111 bool GetValue();
112 void SetValue(const bool state);
113 };
114
115 //----------------------------------------------------------------------
116
117 class wxChoice : public wxControl {
118 public:
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
127 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
128
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
144 class wxComboBox : public wxControl {
145 public:
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
154 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
155
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
185 class wxGauge : public wxControl {
186 public:
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
194 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
195
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
208 class wxStaticBox : public wxControl {
209 public:
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
220 class wxStaticText : public wxControl {
221 public:
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
228 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
229
230 wxString GetLabel();
231 void SetLabel(const wxString& label);
232 };
233
234 //----------------------------------------------------------------------
235
236 class wxListBox : public wxControl {
237 public:
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
246 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
247
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
271 //----------------------------------------------------------------------
272
273 #ifdef __WXMSW__
274 class wxCheckListBox : public wxListBox {
275 public:
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
285 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
286
287 bool IsChecked(int uiIndex);
288 void Check(int uiIndex, bool bCheck = TRUE);
289
290 int GetItemHeight();
291 };
292 #endif
293
294 //----------------------------------------------------------------------
295
296 class wxTextCtrl : public wxControl {
297 public:
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
305 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
306
307 void Clear();
308 void Copy();
309 void Cut();
310 void DiscardEdits();
311 long GetInsertionPoint();
312 long GetLastPosition();
313 #ifdef __WXMSW__
314 int GetLineLength(long lineNo);
315 wxString GetLineText(long lineNo);
316 int GetNumberOfLines();
317 #endif
318 wxString GetValue();
319 bool IsModified();
320 bool LoadFile(const wxString& filename);
321 void Paste();
322 #ifdef __WXMSW__
323 void PositionToXY(long pos, long *OUTPUT, long *OUTPUT);
324 #endif
325 void Remove(long from, long to);
326 void Replace(long from, long to, const wxString& value);
327 bool SaveFile(const wxString& filename);
328 void SetEditable(bool editable);
329 void SetInsertionPoint(long pos);
330 void SetInsertionPointEnd();
331 void SetSelection(long from, long to);
332 void SetValue(const wxString& value);
333 void ShowPosition(long pos);
334 void WriteText(const wxString& text);
335 #ifdef __WXMSW__
336 long XYToPosition(long x, long y);
337 #endif
338 };
339
340 //----------------------------------------------------------------------
341
342 class wxScrollBar : public wxControl {
343 public:
344 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
345 const wxPoint& pos = wxPyDefaultPosition,
346 const wxSize& size = wxPyDefaultSize,
347 long style = wxSB_HORIZONTAL,
348 const wxValidator& validator = wxPyDefaultValidator,
349 char* name = "scrollBar");
350
351 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
352
353 int GetRange();
354 int GetPageSize();
355 int GetPosition();
356 int GetThumbSize();
357 void SetPosition(int viewStart);
358 void SetScrollbar(int position, int thumbSize,
359 int range, int pageSize,
360 bool refresh = TRUE);
361 };
362
363 //----------------------------------------------------------------------
364
365 #ifdef __WXMSW__
366 class wxSpinButton : public wxControl {
367 public:
368 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
369 const wxPoint& pos = wxPyDefaultPosition,
370 const wxSize& size = wxPyDefaultSize,
371 long style = wxSP_HORIZONTAL,
372 char* name = "spinButton");
373
374 int GetMax();
375 int GetMin();
376 int GetValue();
377 void SetRange(int min, int max);
378 void SetValue(int value);
379 };
380 #endif
381
382 //----------------------------------------------------------------------
383
384 class wxStaticBitmap : public wxControl {
385 public:
386 wxStaticBitmap(wxWindow* parent, wxWindowID id,
387 const wxBitmap& bitmap,
388 const wxPoint& pos = wxPyDefaultPosition,
389 const wxSize& size = wxPyDefaultSize,
390 long style = 0,
391 char* name = "staticBitmap");
392
393 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
394
395 wxBitmap& GetBitmap();
396 void SetBitmap(const wxBitmap& bitmap);
397 };
398
399 //----------------------------------------------------------------------
400
401 class wxRadioBox : public wxControl {
402 public:
403 wxRadioBox(wxWindow* parent, wxWindowID id,
404 const wxString& label,
405 const wxPoint& point = wxPyDefaultPosition,
406 const wxSize& size = wxPyDefaultSize,
407 int LCOUNT = 0, wxString* LIST = NULL,
408 int majorDimension = 0,
409 long style = wxRA_HORIZONTAL,
410 const wxValidator& validator = wxPyDefaultValidator,
411 char* name = "radioBox");
412
413 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
414
415 %name(EnableBox)void Enable(bool enable);
416 void Enable(int n, bool enable);
417 int FindString(const wxString& string);
418 #ifdef __WXMSW__
419 %name(GetBoxLabel)wxString GetLabel();
420 #endif
421 wxString GetLabel(int n);
422 int GetSelection();
423 wxString GetString(int n);
424 wxString GetStringSelection();
425 int Number();
426 %name(SetBoxLabel)void SetLabel(const wxString& label);
427 void SetLabel(int n, const wxString& label);
428 void SetSelection(int n);
429 void SetStringSelection(const wxString& string);
430 void Show(bool show);
431 %name(ShowItem)void Show(int item, bool show);
432 };
433
434 //----------------------------------------------------------------------
435
436 class wxRadioButton : public wxControl {
437 public:
438 wxRadioButton(wxWindow* parent, wxWindowID id,
439 const wxString& label,
440 const wxPoint& pos = wxPyDefaultPosition,
441 const wxSize& size = wxPyDefaultSize,
442 long style = 0,
443 const wxValidator& validator = wxPyDefaultValidator,
444 char* name = "radioButton");
445
446 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
447
448 bool GetValue();
449 void SetValue(bool value);
450 };
451
452 //----------------------------------------------------------------------
453
454 class wxSlider : public wxControl {
455 public:
456 wxSlider(wxWindow* parent, wxWindowID id,
457 int value, int minValue, int maxValue,
458 const wxPoint& point = wxPyDefaultPosition,
459 const wxSize& size = wxPyDefaultSize,
460 long style = wxSL_HORIZONTAL,
461 const wxValidator& validator = wxPyDefaultValidator,
462 char* name = "slider");
463
464 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
465
466 void ClearSel();
467 void ClearTicks();
468 int GetLineSize();
469 int GetMax();
470 int GetMin();
471 int GetPageSize();
472 int GetSelEnd();
473 int GetSelStart();
474 int GetThumbLength();
475 int GetTickFreq();
476 int GetValue();
477 void SetRange(int minValue, int maxValue);
478 void SetTickFreq(int n, int pos);
479 void SetLineSize(int lineSize);
480 void SetPageSize(int pageSize);
481 void SetSelection(int startPos, int endPos);
482 void SetThumbLength(int len);
483 void SetTick(int tickPos);
484 void SetValue(int value);
485 };
486
487
488 //----------------------------------------------------------------------
489
490
491 /////////////////////////////////////////////////////////////////////////////
492 //
493 // $Log$
494 // Revision 1.5 1998/10/07 07:34:32 RD
495 // Version 0.4.1 for wxGTK
496 //
497 // Revision 1.4 1998/10/02 06:40:35 RD
498 //
499 // Version 0.4 of wxPython for MSW.
500 //
501 // Revision 1.3 1998/08/18 19:48:14 RD
502 // more wxGTK compatibility things.
503 //
504 // It builds now but there are serious runtime problems...
505 //
506 // Revision 1.2 1998/08/15 07:36:28 RD
507 // - Moved the header in the .i files out of the code that gets put into
508 // the .cpp files. It caused CVS conflicts because of the RCS ID being
509 // different each time.
510 //
511 // - A few minor fixes.
512 //
513 // Revision 1.1 1998/08/09 08:25:49 RD
514 // Initial version
515 //
516 //
517