]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/controls.i
Removed some unnecessary bitmaps; other minor changes
[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 #include <wx/spinbutt.h>
19
20 #ifdef __WXMSW__
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 wx"
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__:wx._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__:wx._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__:wx._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__:wx._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__:wx._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__:wx._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__:wx._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__:wx._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__:wx._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__:wx._StdWindowCallbacks(self)"
306
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
336 class wxScrollBar : public wxControl {
337 public:
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
345 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
346
347 int GetRange();
348 int GetPageSize();
349 int GetThumbPosition();
350 int GetThumbSize();
351 void SetThumbPosition(int viewStart);
352 void SetScrollbar(int position, int thumbSize,
353 int range, int pageSize,
354 bool refresh = TRUE);
355 };
356
357 //----------------------------------------------------------------------
358
359 class wxSpinButton : public wxControl {
360 public:
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
376 class wxStaticBitmap : public wxControl {
377 public:
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
385 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
386
387 wxBitmap& GetBitmap();
388 void SetBitmap(const wxBitmap& bitmap);
389 };
390
391 //----------------------------------------------------------------------
392
393 class wxRadioBox : public wxControl {
394 public:
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
405 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
406
407 %name(EnableBox)void Enable(bool enable);
408 void Enable(int n, bool enable);
409 int FindString(const wxString& string);
410 #ifdef __WXMSW__
411 %name(GetBoxLabel)wxString GetLabel();
412 #endif
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
428 class wxRadioButton : public wxControl {
429 public:
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
438 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
439
440 bool GetValue();
441 void SetValue(bool value);
442 };
443
444 //----------------------------------------------------------------------
445
446 class wxSlider : public wxControl {
447 public:
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
456 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
457
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$
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 //
505 // Revision 1.7 1998/11/16 00:00:53 RD
506 // Generic treectrl for wxPython/GTK compiles...
507 //
508 // Revision 1.6 1998/11/15 23:03:43 RD
509 // Removing some ifdef's for wxGTK
510 //
511 // Revision 1.5 1998/10/07 07:34:32 RD
512 // Version 0.4.1 for wxGTK
513 //
514 // Revision 1.4 1998/10/02 06:40:35 RD
515 //
516 // Version 0.4 of wxPython for MSW.
517 //
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 //
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 //
530 // Revision 1.1 1998/08/09 08:25:49 RD
531 // Initial version
532 //
533 //
534