]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/controls.i
Changes needed to solve wxPython's OOR problem for the wxOGL shapes.
[wxWidgets.git] / 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 #include <wx/spinctrl.h>
20 #include <wx/dynarray.h>
21 #include <wx/statline.h>
22 #include <wx/tglbtn.h>
23
24 #ifdef __WXMSW__
25 #if wxUSE_OWNER_DRAWN
26 #include <wx/checklst.h>
27 #endif
28 #endif
29
30 #ifdef __WXGTK__
31 #include <wx/checklst.h>
32 #endif
33
34 %}
35
36 //----------------------------------------------------------------------
37
38 %include typemaps.i
39 %include my_typemaps.i
40
41 // Import some definitions of other classes, etc.
42 %import _defs.i
43 %import misc.i
44 %import windows.i
45 %import gdi.i
46 %import events.i
47
48 %pragma(python) code = "import wx"
49
50 //----------------------------------------------------------------------
51
52 %readonly
53 wxValidator wxDefaultValidator;
54 %readwrite
55
56 //----------------------------------------------------------------------
57
58 class wxControl : public wxWindow {
59 public:
60 wxControl(wxWindow *parent,
61 wxWindowID id,
62 const wxPoint& pos=wxDefaultPosition,
63 const wxSize& size=wxDefaultSize,
64 long style=0,
65 const wxValidator& validator=wxDefaultValidator,
66 const char* name="control");
67 %name(wxPreControl)wxControl();
68
69 bool Create(wxWindow *parent,
70 wxWindowID id,
71 const wxPoint& pos=wxDefaultPosition,
72 const wxSize& size=wxDefaultSize,
73 long style=0,
74 const wxValidator& validator=wxDefaultValidator,
75 const char* name="control");
76
77 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
78 %pragma(python) addtomethod = "wxPreControl:val._setOORInfo(val)"
79
80 void Command(wxCommandEvent& event);
81 wxString GetLabel();
82 void SetLabel(const wxString& label);
83 };
84
85
86 //----------------------------------------------------------------------
87
88
89 class wxControlWithItems : public wxControl {
90 public:
91
92 // void Clear(); ambiguous, redefine below...
93 void Delete(int n);
94
95 int GetCount();
96 %pragma(python) addtoclass = "Number = GetCount"
97 wxString GetString(int n);
98 void SetString(int n, const wxString& s);
99 int FindString(const wxString& s);
100
101 void Select(int n);
102 int GetSelection();
103
104 wxString GetStringSelection() const;
105
106 // void Append(const wxString& item);
107 // void Append(const wxString& item, char* clientData);
108 // char* GetClientData(const int n);
109 // void SetClientData(const int n, char* data);
110 %addmethods {
111 void Append(const wxString& item, PyObject* clientData=NULL) {
112 if (clientData) {
113 wxPyClientData* data = new wxPyClientData(clientData);
114 self->Append(item, data);
115 } else
116 self->Append(item);
117 }
118
119 PyObject* GetClientData(int n) {
120 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
121 if (data) {
122 Py_INCREF(data->m_obj);
123 return data->m_obj;
124 } else {
125 Py_INCREF(Py_None);
126 return Py_None;
127 }
128 }
129
130 void SetClientData(int n, PyObject* clientData) {
131 wxPyClientData* data = new wxPyClientData(clientData);
132 self->SetClientObject(n, data);
133 }
134 }
135
136 };
137 //----------------------------------------------------------------------
138
139 class wxButton : public wxControl {
140 public:
141 wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
142 const wxPoint& pos = wxDefaultPosition,
143 const wxSize& size = wxDefaultSize,
144 long style = 0,
145 const wxValidator& validator = wxDefaultValidator,
146 char* name = "button");
147 %name(wxPreButton)wxButton();
148
149 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
150 const wxPoint& pos = wxDefaultPosition,
151 const wxSize& size = wxDefaultSize,
152 long style = 0,
153 const wxValidator& validator = wxDefaultValidator,
154 char* name = "button");
155
156 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
157 %pragma(python) addtomethod = "wxPreButton:val._setOORInfo(val)"
158
159 void SetDefault();
160 void SetBackgroundColour(const wxColour& colour);
161 void SetForegroundColour(const wxColour& colour);
162 #ifdef __WXMSW__
163 void SetImageLabel(const wxBitmap& bitmap);
164 void SetImageMargins(wxCoord x, wxCoord y);
165 #endif
166 static wxSize GetDefaultSize();
167 };
168
169 //----------------------------------------------------------------------
170
171 class wxBitmapButton : public wxButton {
172 public:
173 wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
174 const wxPoint& pos = wxDefaultPosition,
175 const wxSize& size = wxDefaultSize,
176 long style = wxBU_AUTODRAW,
177 const wxValidator& validator = wxDefaultValidator,
178 char* name = "button");
179 %name(wxPreBitmapButton)wxBitmapButton();
180
181 bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
182 const wxPoint& pos = wxDefaultPosition,
183 const wxSize& size = wxDefaultSize,
184 long style = wxBU_AUTODRAW,
185 const wxValidator& validator = wxDefaultValidator,
186 char* name = "button");
187
188 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
189 %pragma(python) addtomethod = "wxPreBitmapButton:val._setOORInfo(val)"
190
191 wxBitmap& GetBitmapLabel();
192 wxBitmap& GetBitmapDisabled();
193 wxBitmap& GetBitmapFocus();
194 wxBitmap& GetBitmapSelected();
195 void SetBitmapDisabled(const wxBitmap& bitmap);
196 void SetBitmapFocus(const wxBitmap& bitmap);
197 void SetBitmapSelected(const wxBitmap& bitmap);
198 void SetBitmapLabel(const wxBitmap& bitmap);
199
200 void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
201 int GetMarginX() const { return m_marginX; }
202 int GetMarginY() const { return m_marginY; }
203 };
204
205 //----------------------------------------------------------------------
206
207 class wxCheckBox : public wxControl {
208 public:
209 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
210 const wxPoint& pos = wxDefaultPosition,
211 const wxSize& size = wxDefaultSize,
212 long style = 0,
213 const wxValidator& val = wxDefaultValidator,
214 char* name = "checkBox");
215 %name(wxPreCheckBox)wxCheckBox();
216
217 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
218 const wxPoint& pos = wxDefaultPosition,
219 const wxSize& size = wxDefaultSize,
220 long style = 0,
221 const wxValidator& val = wxDefaultValidator,
222 char* name = "checkBox");
223
224 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
225 %pragma(python) addtomethod = "wxPreCheckBox:val._setOORInfo(val)"
226
227 bool GetValue();
228 void SetValue(const bool state);
229 };
230
231 //----------------------------------------------------------------------
232
233 class wxChoice : public wxControlWithItems {
234 public:
235 wxChoice(wxWindow *parent, wxWindowID id,
236 const wxPoint& pos = wxDefaultPosition,
237 const wxSize& size = wxDefaultSize,
238 int LCOUNT=0, wxString* choices=NULL,
239 long style = 0,
240 const wxValidator& validator = wxDefaultValidator,
241 char* name = "choice");
242 %name(wxPreChoice)wxChoice();
243
244 bool Create(wxWindow *parent, wxWindowID id,
245 const wxPoint& pos = wxDefaultPosition,
246 const wxSize& size = wxDefaultSize,
247 int LCOUNT=0, wxString* choices=NULL,
248 long style = 0,
249 const wxValidator& validator = wxDefaultValidator,
250 char* name = "choice");
251
252 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
253 %pragma(python) addtomethod = "wxPreChoice:val._setOORInfo(val)"
254
255 void Clear();
256
257 int GetColumns();
258 void SetColumns(const int n = 1);
259 void SetSelection(const int n);
260 void SetStringSelection(const wxString& string);
261 void SetString(int n, const wxString& s);
262
263 %pragma(python) addtoclass = "
264 Select = SetSelection
265 "
266 };
267
268 //----------------------------------------------------------------------
269
270 // wxGTK's wxComboBox doesn't derive from wxChoice like wxMSW, or
271 // even wxControlWithItems, so we have to duplicate the methods
272 // here... <blech!>
273
274 #ifdef __WXGTK__
275 class wxComboBox : public wxControl
276 {
277 public:
278 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
279 const wxPoint& pos = wxDefaultPosition,
280 const wxSize& size = wxDefaultSize,
281 int LCOUNT=0, wxString* choices=NULL,
282 long style = 0,
283 const wxValidator& validator = wxDefaultValidator,
284 char* name = "comboBox");
285 %name(wxPreComboBox)wxComboBox();
286
287 bool Create(wxWindow* parent, wxWindowID id, char* value = "",
288 const wxPoint& pos = wxDefaultPosition,
289 const wxSize& size = wxDefaultSize,
290 int LCOUNT=0, wxString* choices=NULL,
291 long style = 0,
292 const wxValidator& validator = wxDefaultValidator,
293 char* name = "comboBox");
294
295 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
296 %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)"
297
298 void Copy();
299 void Cut();
300 long GetInsertionPoint();
301 long GetLastPosition();
302 wxString GetValue();
303 void Paste();
304 void Replace(long from, long to, const wxString& text);
305 void Remove(long from, long to);
306 void SetInsertionPoint(long pos);
307 void SetInsertionPointEnd();
308 void SetSelection(int n);
309 %name(SetMark)void SetSelection(long from, long to);
310 void SetValue(const wxString& text);
311 void SetEditable(bool editable);
312
313
314 void Clear();
315 void Delete(int n);
316
317 int GetCount();
318 %pragma(python) addtoclass = "Number = GetCount"
319 wxString GetString(int n);
320 int FindString(const wxString& s);
321
322 //void SetString(int n, const wxString& s); *** No equivalent for wxGTK!!!
323
324 // void Select(int n);
325 %pragma(python) addtoclass = "Select = SetSelection"
326
327 int GetSelection();
328 wxString GetStringSelection() const;
329
330 // void Append(const wxString& item);
331 // void Append(const wxString& item, char* clientData);
332 // char* GetClientData(const int n);
333 // void SetClientData(const int n, char* data);
334 %addmethods {
335 void Append(const wxString& item, PyObject* clientData=NULL) {
336 if (clientData) {
337 wxPyClientData* data = new wxPyClientData(clientData);
338 self->Append(item, data);
339 } else
340 self->Append(item);
341 }
342
343 PyObject* GetClientData(int n) {
344 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
345 if (data) {
346 Py_INCREF(data->m_obj);
347 return data->m_obj;
348 } else {
349 Py_INCREF(Py_None);
350 return Py_None;
351 }
352 }
353
354 void SetClientData(int n, PyObject* clientData) {
355 wxPyClientData* data = new wxPyClientData(clientData);
356 self->SetClientObject(n, data);
357 }
358 }
359
360 };
361
362
363
364 #else // For all but wxGTK
365
366
367 class wxComboBox : public wxChoice {
368 public:
369 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
370 const wxPoint& pos = wxDefaultPosition,
371 const wxSize& size = wxDefaultSize,
372 int LCOUNT=0, wxString* choices=NULL,
373 long style = 0,
374 const wxValidator& validator = wxDefaultValidator,
375 char* name = "comboBox");
376 %name(wxPreComboBox)wxComboBox();
377
378 bool Create(wxWindow* parent, wxWindowID id, char* value = "",
379 const wxPoint& pos = wxDefaultPosition,
380 const wxSize& size = wxDefaultSize,
381 int LCOUNT=0, wxString* choices=NULL,
382 long style = 0,
383 const wxValidator& validator = wxDefaultValidator,
384 char* name = "comboBox");
385
386 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
387 %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)"
388
389 void Copy();
390 void Cut();
391 long GetInsertionPoint();
392 long GetLastPosition();
393 wxString GetValue();
394 void Paste();
395 void Replace(long from, long to, const wxString& text);
396 void Remove(long from, long to);
397 void SetInsertionPoint(long pos);
398 void SetInsertionPointEnd();
399 void SetSelection(int n);
400 %name(SetMark)void SetSelection(long from, long to);
401 void SetValue(const wxString& text);
402 void SetEditable(bool editable);
403 };
404 #endif
405
406
407 //----------------------------------------------------------------------
408
409 class wxGauge : public wxControl {
410 public:
411 wxGauge(wxWindow* parent, wxWindowID id, int range,
412 const wxPoint& pos = wxDefaultPosition,
413 const wxSize& size = wxDefaultSize,
414 long style = wxGA_HORIZONTAL,
415 const wxValidator& validator = wxDefaultValidator,
416 char* name = "gauge");
417 %name(wxPreGauge)wxGauge();
418
419 bool Create(wxWindow* parent, wxWindowID id, int range,
420 const wxPoint& pos = wxDefaultPosition,
421 const wxSize& size = wxDefaultSize,
422 long style = wxGA_HORIZONTAL,
423 const wxValidator& validator = wxDefaultValidator,
424 char* name = "gauge");
425
426 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
427 %pragma(python) addtomethod = "wxPreGauge:val._setOORInfo(val)"
428
429 int GetBezelFace();
430 int GetRange();
431 int GetShadowWidth();
432 int GetValue();
433 void SetBezelFace(int width);
434 void SetRange(int range);
435 void SetShadowWidth(int width);
436 void SetValue(int pos);
437 };
438
439 //----------------------------------------------------------------------
440
441 class wxStaticBox : public wxControl {
442 public:
443 wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
444 const wxPoint& pos = wxDefaultPosition,
445 const wxSize& size = wxDefaultSize,
446 long style = 0,
447 char* name = "staticBox");
448 %name(wxPreStaticBox)wxStaticBox();
449
450 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
451 const wxPoint& pos = wxDefaultPosition,
452 const wxSize& size = wxDefaultSize,
453 long style = 0,
454 char* name = "staticBox");
455
456 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
457 %pragma(python) addtomethod = "wxPreStaticBox:val._setOORInfo(val)"
458 };
459
460
461 //----------------------------------------------------------------------
462
463
464 class wxStaticLine : public wxControl {
465 public:
466 wxStaticLine( wxWindow *parent, wxWindowID id,
467 const wxPoint &pos = wxDefaultPosition,
468 const wxSize &size = wxDefaultSize,
469 long style = wxLI_HORIZONTAL,
470 const char* name = "staticLine" );
471 %name(wxPreStaticLine)wxStaticLine();
472
473 bool Create( wxWindow *parent, wxWindowID id,
474 const wxPoint &pos = wxDefaultPosition,
475 const wxSize &size = wxDefaultSize,
476 long style = wxLI_HORIZONTAL,
477 const char* name = "staticLine" );
478
479 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
480 %pragma(python) addtomethod = "wxPreStaticLine:val._setOORInfo(val)"
481 };
482
483
484 //----------------------------------------------------------------------
485
486 class wxStaticText : public wxControl {
487 public:
488 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
489 const wxPoint& pos = wxDefaultPosition,
490 const wxSize& size = wxDefaultSize,
491 long style = 0,
492 char* name = "staticText");
493 %name(wxPreStaticText)wxStaticText();
494
495 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
496 const wxPoint& pos = wxDefaultPosition,
497 const wxSize& size = wxDefaultSize,
498 long style = 0,
499 char* name = "staticText");
500
501 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
502 %pragma(python) addtomethod = "wxPreStaticText:val._setOORInfo(val)"
503
504 wxString GetLabel();
505 void SetLabel(const wxString& label);
506 };
507
508 //----------------------------------------------------------------------
509
510 class wxListBox : public wxControlWithItems {
511 public:
512 wxListBox(wxWindow* parent, wxWindowID id,
513 const wxPoint& pos = wxDefaultPosition,
514 const wxSize& size = wxDefaultSize,
515 int LCOUNT, wxString* choices = NULL,
516 long style = 0,
517 const wxValidator& validator = wxDefaultValidator,
518 char* name = "listBox");
519 %name(wxPreListBox)wxListBox();
520
521 bool Create(wxWindow* parent, wxWindowID id,
522 const wxPoint& pos = wxDefaultPosition,
523 const wxSize& size = wxDefaultSize,
524 int LCOUNT, wxString* choices = NULL,
525 long style = 0,
526 const wxValidator& validator = wxDefaultValidator,
527 char* name = "listBox");
528
529 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
530 %pragma(python) addtomethod = "wxPreListBox:val._setOORInfo(val)"
531
532 void Clear();
533 void Deselect(int n);
534
535 // int GetSelections(int **selections);
536 %addmethods {
537 PyObject* GetSelections() {
538 wxArrayInt lst;
539 self->GetSelections(lst);
540 PyObject *tup = PyTuple_New(lst.GetCount());
541 for(size_t i=0; i<lst.GetCount(); i++) {
542 PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
543 }
544 return tup;
545 }
546 }
547
548
549 void InsertItems(int LCOUNT, wxString* choices, int pos);
550
551 bool IsSelected(const int n);
552 bool Selected(const int n);
553 void Set(int LCOUNT, wxString* choices);
554 void SetFirstItem(int n);
555 %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
556 void SetSelection(int n, bool select = TRUE);
557 void SetString(int n, const wxString& string);
558 void SetStringSelection(const wxString& string, bool select = TRUE);
559 };
560
561
562 //----------------------------------------------------------------------
563
564 class wxCheckListBox : public wxListBox {
565 public:
566 wxCheckListBox(wxWindow *parent, wxWindowID id,
567 const wxPoint& pos = wxDefaultPosition,
568 const wxSize& size = wxDefaultSize,
569 int LCOUNT = 0,
570 wxString* choices = NULL,
571 long style = 0,
572 const wxValidator& validator = wxDefaultValidator,
573 char* name = "listBox");
574 %name(wxPreCheckListBox)wxCheckListBox();
575
576 bool Create(wxWindow *parent, wxWindowID id,
577 const wxPoint& pos = wxDefaultPosition,
578 const wxSize& size = wxDefaultSize,
579 int LCOUNT = 0,
580 wxString* choices = NULL,
581 long style = 0,
582 const wxValidator& validator = wxDefaultValidator,
583 char* name = "listBox");
584
585 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
586 %pragma(python) addtomethod = "wxPreCheckListBox:val._setOORInfo(val)"
587
588 bool IsChecked(int uiIndex);
589 void Check(int uiIndex, int bCheck = TRUE);
590 void InsertItems(int LCOUNT, wxString* choices, int pos);
591
592 #ifndef __WXMAC__
593 int GetItemHeight();
594 #endif
595 };
596
597 //----------------------------------------------------------------------
598
599
600 class wxTextAttr
601 {
602 public:
603 // ctors
604 wxTextAttr(const wxColour& colText = wxNullColour,
605 const wxColour& colBack = wxNullColour,
606 const wxFont& font = wxNullFont);
607 ~wxTextAttr();
608
609 // setters
610 void SetTextColour(const wxColour& colText);
611 void SetBackgroundColour(const wxColour& colBack);
612 void SetFont(const wxFont& font);
613
614 // accessors
615 bool HasTextColour() const;
616 bool HasBackgroundColour() const;
617 bool HasFont() const;
618
619 const wxColour& GetTextColour() const;
620 const wxColour& GetBackgroundColour() const;
621 const wxFont& GetFont() const;
622
623 // returns false if we have any attributes set, true otherwise
624 bool IsDefault();
625 };
626
627
628
629 class wxTextCtrl : public wxControl {
630 public:
631 wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
632 const wxPoint& pos = wxDefaultPosition,
633 const wxSize& size = wxDefaultSize,
634 long style = 0,
635 const wxValidator& validator = wxDefaultValidator,
636 char* name = "text");
637 %name(wxPreTextCtrl)wxTextCtrl();
638
639 bool Create(wxWindow* parent, wxWindowID id, char* value = "",
640 const wxPoint& pos = wxDefaultPosition,
641 const wxSize& size = wxDefaultSize,
642 long style = 0,
643 const wxValidator& validator = wxDefaultValidator,
644 char* name = "text");
645
646 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
647 %pragma(python) addtomethod = "wxPreTextCtrl:val._setOORInfo(val)"
648
649
650 wxString GetValue() const;
651 void SetValue(const wxString& value);
652
653 int GetLineLength(long lineNo) const;
654 wxString GetLineText(long lineNo) const;
655 int GetNumberOfLines() const;
656
657 bool IsModified() const;
658 bool IsEditable() const;
659
660 // If the return values from and to are the same, there is no selection.
661 void GetSelection(long* OUTPUT, long* OUTPUT) const;
662 wxString GetStringSelection();
663
664 void Clear();
665 void Replace(long from, long to, const wxString& value);
666 void Remove(long from, long to);
667
668 // load/save the controls contents from/to the file
669 bool LoadFile(const wxString& file);
670 bool SaveFile(const wxString& file = wxEmptyString);
671
672 // clears the dirty flag
673 void DiscardEdits();
674
675 // set the max number of characters which may be entered in a single line
676 // text control
677 void SetMaxLength(unsigned long len);
678
679 // writing text inserts it at the current position, appending always
680 // inserts it at the end
681 void WriteText(const wxString& text);
682 void AppendText(const wxString& text);
683
684 // text control under some platforms supports the text styles: these
685 // methods allow to apply the given text style to the given selection or to
686 // set/get the style which will be used for all appended text
687 bool SetStyle(long start, long end, const wxTextAttr& style);
688 bool SetDefaultStyle(const wxTextAttr& style);
689 const wxTextAttr& GetDefaultStyle() const;
690
691 // translate between the position (which is just an index in the text ctrl
692 // considering all its contents as a single strings) and (x, y) coordinates
693 // which represent column and line.
694 long XYToPosition(long x, long y) const;
695 bool PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const;
696
697 void ShowPosition(long pos);
698
699 // Clipboard operations
700 void Copy();
701 void Cut();
702 void Paste();
703
704 bool CanCopy() const;
705 bool CanCut() const;
706 bool CanPaste() const;
707
708 // Undo/redo
709 void Undo();
710 void Redo();
711
712 bool CanUndo() const;
713 bool CanRedo() const;
714
715 // Insertion point
716 void SetInsertionPoint(long pos);
717 void SetInsertionPointEnd();
718 long GetInsertionPoint() const;
719 long GetLastPosition() const;
720
721 void SetSelection(long from, long to);
722 void SelectAll();
723 void SetEditable(bool editable);
724
725 %addmethods {
726 void write(const wxString& text) {
727 self->AppendText(text);
728 }
729 }
730 };
731
732 //----------------------------------------------------------------------
733
734 class wxScrollBar : public wxControl {
735 public:
736 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
737 const wxPoint& pos = wxDefaultPosition,
738 const wxSize& size = wxDefaultSize,
739 long style = wxSB_HORIZONTAL,
740 const wxValidator& validator = wxDefaultValidator,
741 char* name = "scrollBar");
742 %name(wxPreScrollBar)wxScrollBar();
743
744 bool Create(wxWindow* parent, wxWindowID id = -1,
745 const wxPoint& pos = wxDefaultPosition,
746 const wxSize& size = wxDefaultSize,
747 long style = wxSB_HORIZONTAL,
748 const wxValidator& validator = wxDefaultValidator,
749 char* name = "scrollBar");
750
751 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
752 %pragma(python) addtomethod = "wxPreScrollBar:val._setOORInfo(val)"
753
754 int GetRange();
755 int GetPageSize();
756 int GetThumbPosition();
757 int GetThumbSize();
758 %name(GetThumbLength) int GetThumbSize(); // to match the docs
759
760 bool IsVertical();
761
762 void SetThumbPosition(int viewStart);
763 void SetScrollbar(int position, int thumbSize,
764 int range, int pageSize,
765 bool refresh = TRUE);
766 };
767
768 //----------------------------------------------------------------------
769
770 class wxSpinButton : public wxControl {
771 public:
772 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
773 const wxPoint& pos = wxDefaultPosition,
774 const wxSize& size = wxDefaultSize,
775 long style = wxSP_HORIZONTAL,
776 char* name = "spinButton");
777 %name(wxPreSpinButton)wxSpinButton();
778
779 bool Create(wxWindow* parent, wxWindowID id = -1,
780 const wxPoint& pos = wxDefaultPosition,
781 const wxSize& size = wxDefaultSize,
782 long style = wxSP_HORIZONTAL,
783 char* name = "spinButton");
784
785 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
786 %pragma(python) addtomethod = "wxPreSpinButton:val._setOORInfo(val)"
787
788 int GetMax();
789 int GetMin();
790 int GetValue();
791 void SetRange(int min, int max);
792 void SetValue(int value);
793 };
794
795 //----------------------------------------------------------------------
796
797 class wxStaticBitmap : public wxControl {
798 public:
799 wxStaticBitmap(wxWindow* parent, wxWindowID id,
800 const wxBitmap& bitmap,
801 const wxPoint& pos = wxDefaultPosition,
802 const wxSize& size = wxDefaultSize,
803 long style = 0,
804 char* name = "staticBitmap");
805 %name(wxPreStaticBitmap)wxStaticBitmap();
806
807 bool Create(wxWindow* parent, wxWindowID id,
808 const wxBitmap& bitmap,
809 const wxPoint& pos = wxDefaultPosition,
810 const wxSize& size = wxDefaultSize,
811 long style = 0,
812 char* name = "staticBitmap");
813
814 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
815 %pragma(python) addtomethod = "wxPreStaticBitmap:val._setOORInfo(val)"
816
817 const wxBitmap& GetBitmap();
818 void SetBitmap(const wxBitmap& bitmap);
819 void SetIcon(const wxIcon& icon);
820 };
821
822 //----------------------------------------------------------------------
823
824 class wxRadioBox : public wxControl {
825 public:
826 wxRadioBox(wxWindow* parent, wxWindowID id,
827 const wxString& label,
828 const wxPoint& point = wxDefaultPosition,
829 const wxSize& size = wxDefaultSize,
830 int LCOUNT = 0, wxString* choices = NULL,
831 int majorDimension = 0,
832 long style = wxRA_HORIZONTAL,
833 const wxValidator& validator = wxDefaultValidator,
834 char* name = "radioBox");
835 %name(wxPreRadioBox)wxRadioBox();
836
837 bool Create(wxWindow* parent, wxWindowID id,
838 const wxString& label,
839 const wxPoint& point = wxDefaultPosition,
840 const wxSize& size = wxDefaultSize,
841 int LCOUNT = 0, wxString* choices = NULL,
842 int majorDimension = 0,
843 long style = wxRA_HORIZONTAL,
844 const wxValidator& validator = wxDefaultValidator,
845 char* name = "radioBox");
846
847 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
848 %pragma(python) addtomethod = "wxPreRadioBox:val._setOORInfo(val)"
849
850 void Enable(bool enable);
851 %name(EnableItem)void Enable(int n, bool enable);
852 int FindString(const wxString& string);
853
854 wxString GetString(int n);
855
856 #ifdef __WXGTK__
857 %name(GetItemLabel)wxString GetLabel( int item );
858 %name(SetItemLabel)void SetLabel( int item, const wxString& label );
859 #else
860 void SetString(int n, const wxString& label);
861 %pragma(python) addtoclass = "
862 GetItemLabel = GetString
863 SetItemLabel = SetString
864 "
865 int GetColumnCount();
866 int GetRowCount();
867 #endif
868
869 int GetSelection();
870 wxString GetStringSelection();
871 int GetCount();
872 %pragma(python) addtoclass = "Number = GetCount"
873
874 void SetSelection(int n);
875 void SetStringSelection(const wxString& string);
876 void Show(bool show);
877 %name(ShowItem)void Show(int item, bool show);
878 };
879
880 //----------------------------------------------------------------------
881
882 class wxRadioButton : public wxControl {
883 public:
884 wxRadioButton(wxWindow* parent, wxWindowID id,
885 const wxString& label,
886 const wxPoint& pos = wxDefaultPosition,
887 const wxSize& size = wxDefaultSize,
888 long style = 0,
889 const wxValidator& validator = wxDefaultValidator,
890 char* name = "radioButton");
891 %name(wxPreRadioButton)wxRadioButton();
892
893 bool Create(wxWindow* parent, wxWindowID id,
894 const wxString& label,
895 const wxPoint& pos = wxDefaultPosition,
896 const wxSize& size = wxDefaultSize,
897 long style = 0,
898 const wxValidator& validator = wxDefaultValidator,
899 char* name = "radioButton");
900
901 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
902 %pragma(python) addtomethod = "wxPreRadioButton:val._setOORInfo(val)"
903
904 bool GetValue();
905 void SetValue(bool value);
906 };
907
908 //----------------------------------------------------------------------
909
910 class wxSlider : public wxControl {
911 public:
912 wxSlider(wxWindow* parent, wxWindowID id,
913 int value, int minValue, int maxValue,
914 const wxPoint& point = wxDefaultPosition,
915 const wxSize& size = wxDefaultSize,
916 long style = wxSL_HORIZONTAL,
917 const wxValidator& validator = wxDefaultValidator,
918 char* name = "slider");
919 %name(wxPreSlider)wxSlider();
920
921 bool Create(wxWindow* parent, wxWindowID id,
922 int value, int minValue, int maxValue,
923 const wxPoint& point = wxDefaultPosition,
924 const wxSize& size = wxDefaultSize,
925 long style = wxSL_HORIZONTAL,
926 const wxValidator& validator = wxDefaultValidator,
927 char* name = "slider");
928
929 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
930 %pragma(python) addtomethod = "wxPreSlider:val._setOORInfo(val)"
931
932 void ClearSel();
933 void ClearTicks();
934 int GetLineSize();
935 int GetMax();
936 int GetMin();
937 int GetPageSize();
938 int GetSelEnd();
939 int GetSelStart();
940 int GetThumbLength();
941 int GetTickFreq();
942 int GetValue();
943 void SetRange(int minValue, int maxValue);
944 void SetTickFreq(int n, int pos);
945 void SetLineSize(int lineSize);
946 void SetPageSize(int pageSize);
947 void SetSelection(int startPos, int endPos);
948 void SetThumbLength(int len);
949 void SetTick(int tickPos);
950 void SetValue(int value);
951 };
952
953
954 //----------------------------------------------------------------------
955
956 class wxSpinCtrl : public wxSpinButton {
957 public:
958 wxSpinCtrl(wxWindow *parent,
959 wxWindowID id = -1,
960 const char* value = "",
961 const wxPoint& pos = wxDefaultPosition,
962 const wxSize& size = wxDefaultSize,
963 long style = wxSP_ARROW_KEYS,
964 int min = 0, int max = 100, int initial = 0,
965 const char* name = "wxSpinCtrl");
966 %name(wxPreSpinCtrl)wxSpinCtrl();
967
968 bool Create(wxWindow *parent,
969 wxWindowID id = -1,
970 const char* value = "",
971 const wxPoint& pos = wxDefaultPosition,
972 const wxSize& size = wxDefaultSize,
973 long style = wxSP_ARROW_KEYS,
974 int min = 0, int max = 100, int initial = 0,
975 const char* name = "wxSpinCtrl");
976
977 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
978 %pragma(python) addtomethod = "wxPreSpinCtrl:val._setOORInfo(val)"
979
980 int GetMax();
981 int GetMin();
982 int GetValue();
983 void SetRange(int min, int max);
984 void SetValue(int value);
985
986 };
987
988
989 //----------------------------------------------------------------------
990
991 #ifndef __WXMAC__
992 enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, };
993
994 class wxToggleButton : public wxControl {
995 public:
996 wxToggleButton(wxWindow *parent,
997 wxWindowID id,
998 const wxString& label,
999 const wxPoint& pos = wxDefaultPosition,
1000 const wxSize& size = wxDefaultSize,
1001 long style = 0,
1002 const wxValidator& validator = wxDefaultValidator,
1003 const char* name = "toggle");
1004 %name(wxPreToggleButton)wxToggleButton();
1005
1006 bool Create(wxWindow *parent,
1007 wxWindowID id,
1008 const wxString& label,
1009 const wxPoint& pos = wxDefaultPosition,
1010 const wxSize& size = wxDefaultSize,
1011 long style = 0,
1012 const wxValidator& validator = wxDefaultValidator,
1013 const char* name = "toggle");
1014
1015 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
1016 %pragma(python) addtomethod = "wxPreToggleButton:val._setOORInfo(val)"
1017
1018 void SetValue(bool value);
1019 bool GetValue() const ;
1020 void SetLabel(const wxString& label);
1021
1022 };
1023
1024 #endif
1025 //----------------------------------------------------------------------
1026 //----------------------------------------------------------------------
1027 //----------------------------------------------------------------------
1028
1029
1030