1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Control (widget) classes for wxPython
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
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>
26 #include <wx/checklst.h>
31 #include <wx/checklst.h>
36 //----------------------------------------------------------------------
39 %include my_typemaps.i
41 // Import some definitions of other classes, etc.
48 %pragma(python) code = "import wx"
50 //----------------------------------------------------------------------
53 wxValidator wxDefaultValidator;
56 //----------------------------------------------------------------------
59 // This is the base class for a control or 'widget'.
61 // A control is generally a small window which processes user input and/or
62 // displays one or more item of data.
63 class wxControl : public wxWindow {
67 wxControl(wxWindow *parent,
69 const wxPoint& pos=wxDefaultPosition,
70 const wxSize& size=wxDefaultSize,
72 const wxValidator& validator=wxDefaultValidator,
73 const char* name="control");
76 %name(wxPreControl)wxControl();
79 bool Create(wxWindow *parent,
81 const wxPoint& pos=wxDefaultPosition,
82 const wxSize& size=wxDefaultSize,
84 const wxValidator& validator=wxDefaultValidator,
85 const char* name="control");
87 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
88 %pragma(python) addtomethod = "wxPreControl:val._setOORInfo(val)"
90 // Simulates the effect of the user issuing a command to the item. See
92 void Command(wxCommandEvent& event);
94 // Return a control's text.
97 // Sets the item's text.
98 void SetLabel(const wxString& label);
102 //----------------------------------------------------------------------
105 class wxControlWithItems : public wxControl {
108 // void Clear(); ambiguous, redefine below...
110 // Deletes an item from the control
113 // Returns the number of items in the control.
115 %pragma(python) addtoclass = "Number = GetCount"
117 // Returns the string at the given position.
118 wxString GetString(int n);
120 // Sets the string value of an item.
121 void SetString(int n, const wxString& s);
123 // Finds an item matching the given string. Returns the zero-based
124 // position of the item, or -1 if the string was not found.
125 int FindString(const wxString& s);
127 // Select the item at postion n.
130 // Gets the position of the selected item.
133 // Gets the current selection as a string.
134 wxString GetStringSelection() const;
136 // void Append(const wxString& item);
137 // void Append(const wxString& item, char* clientData);
138 // char* GetClientData(const int n);
139 // void SetClientData(const int n, char* data);
143 // Adds the item to the control, associating the given data with the
145 void Append(const wxString& item, PyObject* clientData=NULL) {
147 wxPyClientData* data = new wxPyClientData(clientData);
148 self->Append(item, data);
153 // Returns the client data associated with the given item, (if any.)
154 PyObject* GetClientData(int n) {
155 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
157 Py_INCREF(data->m_obj);
165 // Associate the given client data with the item at position n.
166 void SetClientData(int n, PyObject* clientData) {
167 wxPyClientData* data = new wxPyClientData(clientData);
168 self->SetClientObject(n, data);
174 //----------------------------------------------------------------------
176 // A button is a control that contains a text string, and is one of the most
177 // common elements of a GUI. It may be placed on a dialog box or panel, or
178 // indeed almost any other window.
181 // wxBU_LEFT: Left-justifies the label. WIN32 only.
182 // wxBU_TOP: Aligns the label to the top of the button. WIN32 only.
183 // wxBU_RIGHT: Right-justifies the bitmap label. WIN32 only.
184 // wxBU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only.
185 // wxBU_EXACTFIT: Creates the button as small as possible instead of making
186 // it of the standard size (which is the default behaviour.)
189 // EVT_BUTTON(win,id,func):
190 // Sent when the button is clicked.
192 class wxButton : public wxControl {
194 // Constructor, creating and showing a button.
196 // parent: Parent window. Must not be None.
197 // id: Button identifier. A value of -1 indicates a default value.
198 // label: The text to be displayed on the button.
199 // pos: The button position on it's parent.
200 // size: Button size. If the default size (-1, -1) is specified then the
201 // button is sized appropriately for the text.
202 // style: Window style. See wxButton.
203 // validator: Window validator.
204 // name: Window name.
205 wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
206 const wxPoint& pos = wxDefaultPosition,
207 const wxSize& size = wxDefaultSize,
209 const wxValidator& validator = wxDefaultValidator,
210 char* name = "button");
212 // Default constructor
213 %name(wxPreButton)wxButton();
215 // Button creation function for two-step creation.
216 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
217 const wxPoint& pos = wxDefaultPosition,
218 const wxSize& size = wxDefaultSize,
220 const wxValidator& validator = wxDefaultValidator,
221 char* name = "button");
223 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
224 %pragma(python) addtomethod = "wxPreButton:val._setOORInfo(val)"
226 // This sets the button to be the default item for the panel or dialog box.
228 // Under Windows, only dialog box buttons respond to this function. As
229 // normal under Windows and Motif, pressing return causes the default
230 // button to be depressed when the return key is pressed. See also
231 // wxWindow.SetFocus which sets the keyboard focus for windows and text
232 // panel items, and wxPanel.SetDefaultItem.
236 void SetBackgroundColour(const wxColour& colour);
238 void SetForegroundColour(const wxColour& colour);
241 // show the image in the button in addition to the label
242 void SetImageLabel(const wxBitmap& bitmap);
244 // set the margins around the image
245 void SetImageMargins(wxCoord x, wxCoord y);
248 // returns the default button size for this platform
249 static wxSize GetDefaultSize();
252 //----------------------------------------------------------------------
254 class wxBitmapButton : public wxButton {
256 wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
257 const wxPoint& pos = wxDefaultPosition,
258 const wxSize& size = wxDefaultSize,
259 long style = wxBU_AUTODRAW,
260 const wxValidator& validator = wxDefaultValidator,
261 char* name = "button");
262 %name(wxPreBitmapButton)wxBitmapButton();
264 bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
265 const wxPoint& pos = wxDefaultPosition,
266 const wxSize& size = wxDefaultSize,
267 long style = wxBU_AUTODRAW,
268 const wxValidator& validator = wxDefaultValidator,
269 char* name = "button");
271 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
272 %pragma(python) addtomethod = "wxPreBitmapButton:val._setOORInfo(val)"
274 wxBitmap GetBitmapLabel();
275 wxBitmap GetBitmapDisabled();
276 wxBitmap GetBitmapFocus();
277 wxBitmap GetBitmapSelected();
278 void SetBitmapDisabled(const wxBitmap& bitmap);
279 void SetBitmapFocus(const wxBitmap& bitmap);
280 void SetBitmapSelected(const wxBitmap& bitmap);
281 void SetBitmapLabel(const wxBitmap& bitmap);
283 void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
284 int GetMarginX() const { return m_marginX; }
285 int GetMarginY() const { return m_marginY; }
288 //----------------------------------------------------------------------
290 class wxCheckBox : public wxControl {
292 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
293 const wxPoint& pos = wxDefaultPosition,
294 const wxSize& size = wxDefaultSize,
296 const wxValidator& val = wxDefaultValidator,
297 char* name = "checkBox");
298 %name(wxPreCheckBox)wxCheckBox();
300 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
301 const wxPoint& pos = wxDefaultPosition,
302 const wxSize& size = wxDefaultSize,
304 const wxValidator& val = wxDefaultValidator,
305 char* name = "checkBox");
307 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
308 %pragma(python) addtomethod = "wxPreCheckBox:val._setOORInfo(val)"
311 void SetValue(const bool state);
314 //----------------------------------------------------------------------
316 class wxChoice : public wxControlWithItems {
318 wxChoice(wxWindow *parent, wxWindowID id,
319 const wxPoint& pos = wxDefaultPosition,
320 const wxSize& size = wxDefaultSize,
321 int LCOUNT=0, wxString* choices=NULL,
323 const wxValidator& validator = wxDefaultValidator,
324 char* name = "choice");
325 %name(wxPreChoice)wxChoice();
327 bool Create(wxWindow *parent, wxWindowID id,
328 const wxPoint& pos = wxDefaultPosition,
329 const wxSize& size = wxDefaultSize,
330 int LCOUNT=0, wxString* choices=NULL,
332 const wxValidator& validator = wxDefaultValidator,
333 char* name = "choice");
335 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
336 %pragma(python) addtomethod = "wxPreChoice:val._setOORInfo(val)"
341 void SetColumns(const int n = 1);
342 void SetSelection(const int n);
343 void SetStringSelection(const wxString& string);
344 void SetString(int n, const wxString& s);
346 %pragma(python) addtoclass = "
347 Select = SetSelection
351 //----------------------------------------------------------------------
353 // wxGTK's wxComboBox doesn't derive from wxChoice like wxMSW, or
354 // even wxControlWithItems, so we have to duplicate the methods
358 class wxComboBox : public wxControl
361 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
362 const wxPoint& pos = wxDefaultPosition,
363 const wxSize& size = wxDefaultSize,
364 int LCOUNT=0, wxString* choices=NULL,
366 const wxValidator& validator = wxDefaultValidator,
367 char* name = "comboBox");
368 %name(wxPreComboBox)wxComboBox();
370 bool Create(wxWindow* parent, wxWindowID id, char* value = "",
371 const wxPoint& pos = wxDefaultPosition,
372 const wxSize& size = wxDefaultSize,
373 int LCOUNT=0, wxString* choices=NULL,
375 const wxValidator& validator = wxDefaultValidator,
376 char* name = "comboBox");
378 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
379 %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)"
383 long GetInsertionPoint();
384 long GetLastPosition();
387 void Replace(long from, long to, const wxString& text);
388 void Remove(long from, long to);
389 void SetInsertionPoint(long pos);
390 void SetInsertionPointEnd();
391 void SetSelection(int n);
392 %name(SetMark)void SetSelection(long from, long to);
393 void SetValue(const wxString& text);
394 void SetEditable(bool editable);
401 %pragma(python) addtoclass = "Number = GetCount"
402 wxString GetString(int n);
403 int FindString(const wxString& s);
405 //void SetString(int n, const wxString& s); *** No equivalent for wxGTK!!!
407 // void Select(int n);
408 %pragma(python) addtoclass = "Select = SetSelection"
411 wxString GetStringSelection() const;
413 // void Append(const wxString& item);
414 // void Append(const wxString& item, char* clientData);
415 // char* GetClientData(const int n);
416 // void SetClientData(const int n, char* data);
418 void Append(const wxString& item, PyObject* clientData=NULL) {
420 wxPyClientData* data = new wxPyClientData(clientData);
421 self->Append(item, data);
426 PyObject* GetClientData(int n) {
427 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
429 Py_INCREF(data->m_obj);
437 void SetClientData(int n, PyObject* clientData) {
438 wxPyClientData* data = new wxPyClientData(clientData);
439 self->SetClientObject(n, data);
447 #else // For all but wxGTK
450 class wxComboBox : public wxChoice {
452 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
453 const wxPoint& pos = wxDefaultPosition,
454 const wxSize& size = wxDefaultSize,
455 int LCOUNT=0, wxString* choices=NULL,
457 const wxValidator& validator = wxDefaultValidator,
458 char* name = "comboBox");
459 %name(wxPreComboBox)wxComboBox();
461 bool Create(wxWindow* parent, wxWindowID id, char* value = "",
462 const wxPoint& pos = wxDefaultPosition,
463 const wxSize& size = wxDefaultSize,
464 int LCOUNT=0, wxString* choices=NULL,
466 const wxValidator& validator = wxDefaultValidator,
467 char* name = "comboBox");
469 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
470 %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)"
474 long GetInsertionPoint();
475 long GetLastPosition();
478 void Replace(long from, long to, const wxString& text);
479 void Remove(long from, long to);
480 void SetInsertionPoint(long pos);
481 void SetInsertionPointEnd();
482 void SetSelection(int n);
483 %name(SetMark)void SetSelection(long from, long to);
484 void SetValue(const wxString& text);
485 void SetEditable(bool editable);
490 //----------------------------------------------------------------------
492 class wxGauge : public wxControl {
494 wxGauge(wxWindow* parent, wxWindowID id, int range,
495 const wxPoint& pos = wxDefaultPosition,
496 const wxSize& size = wxDefaultSize,
497 long style = wxGA_HORIZONTAL,
498 const wxValidator& validator = wxDefaultValidator,
499 char* name = "gauge");
500 %name(wxPreGauge)wxGauge();
502 bool Create(wxWindow* parent, wxWindowID id, int range,
503 const wxPoint& pos = wxDefaultPosition,
504 const wxSize& size = wxDefaultSize,
505 long style = wxGA_HORIZONTAL,
506 const wxValidator& validator = wxDefaultValidator,
507 char* name = "gauge");
509 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
510 %pragma(python) addtomethod = "wxPreGauge:val._setOORInfo(val)"
514 int GetShadowWidth();
516 void SetBezelFace(int width);
517 void SetRange(int range);
518 void SetShadowWidth(int width);
519 void SetValue(int pos);
522 //----------------------------------------------------------------------
524 class wxStaticBox : public wxControl {
526 wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
527 const wxPoint& pos = wxDefaultPosition,
528 const wxSize& size = wxDefaultSize,
530 char* name = "staticBox");
531 %name(wxPreStaticBox)wxStaticBox();
533 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
534 const wxPoint& pos = wxDefaultPosition,
535 const wxSize& size = wxDefaultSize,
537 char* name = "staticBox");
539 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
540 %pragma(python) addtomethod = "wxPreStaticBox:val._setOORInfo(val)"
544 //----------------------------------------------------------------------
547 class wxStaticLine : public wxControl {
549 wxStaticLine( wxWindow *parent, wxWindowID id,
550 const wxPoint &pos = wxDefaultPosition,
551 const wxSize &size = wxDefaultSize,
552 long style = wxLI_HORIZONTAL,
553 const char* name = "staticLine" );
554 %name(wxPreStaticLine)wxStaticLine();
556 bool Create( wxWindow *parent, wxWindowID id,
557 const wxPoint &pos = wxDefaultPosition,
558 const wxSize &size = wxDefaultSize,
559 long style = wxLI_HORIZONTAL,
560 const char* name = "staticLine" );
562 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
563 %pragma(python) addtomethod = "wxPreStaticLine:val._setOORInfo(val)"
567 //----------------------------------------------------------------------
569 class wxStaticText : public wxControl {
571 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
572 const wxPoint& pos = wxDefaultPosition,
573 const wxSize& size = wxDefaultSize,
575 char* name = "staticText");
576 %name(wxPreStaticText)wxStaticText();
578 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
579 const wxPoint& pos = wxDefaultPosition,
580 const wxSize& size = wxDefaultSize,
582 char* name = "staticText");
584 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
585 %pragma(python) addtomethod = "wxPreStaticText:val._setOORInfo(val)"
588 void SetLabel(const wxString& label);
591 //----------------------------------------------------------------------
593 class wxListBox : public wxControlWithItems {
595 wxListBox(wxWindow* parent, wxWindowID id,
596 const wxPoint& pos = wxDefaultPosition,
597 const wxSize& size = wxDefaultSize,
598 int LCOUNT, wxString* choices = NULL,
600 const wxValidator& validator = wxDefaultValidator,
601 char* name = "listBox");
602 %name(wxPreListBox)wxListBox();
604 bool Create(wxWindow* parent, wxWindowID id,
605 const wxPoint& pos = wxDefaultPosition,
606 const wxSize& size = wxDefaultSize,
607 int LCOUNT, wxString* choices = NULL,
609 const wxValidator& validator = wxDefaultValidator,
610 char* name = "listBox");
612 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
613 %pragma(python) addtomethod = "wxPreListBox:val._setOORInfo(val)"
616 void Deselect(int n);
618 // int GetSelections(int **selections);
620 PyObject* GetSelections() {
622 self->GetSelections(lst);
623 PyObject *tup = PyTuple_New(lst.GetCount());
624 for(size_t i=0; i<lst.GetCount(); i++) {
625 PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
632 void InsertItems(int LCOUNT, wxString* choices, int pos);
634 bool IsSelected(const int n);
635 bool Selected(const int n);
636 void Set(int LCOUNT, wxString* choices);
637 void SetFirstItem(int n);
638 %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
639 void SetSelection(int n, bool select = TRUE);
640 void SetString(int n, const wxString& string);
641 void SetStringSelection(const wxString& string, bool select = TRUE);
645 //----------------------------------------------------------------------
647 class wxCheckListBox : public wxListBox {
649 wxCheckListBox(wxWindow *parent, wxWindowID id,
650 const wxPoint& pos = wxDefaultPosition,
651 const wxSize& size = wxDefaultSize,
653 wxString* choices = NULL,
655 const wxValidator& validator = wxDefaultValidator,
656 char* name = "listBox");
657 %name(wxPreCheckListBox)wxCheckListBox();
659 bool Create(wxWindow *parent, wxWindowID id,
660 const wxPoint& pos = wxDefaultPosition,
661 const wxSize& size = wxDefaultSize,
663 wxString* choices = NULL,
665 const wxValidator& validator = wxDefaultValidator,
666 char* name = "listBox");
668 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
669 %pragma(python) addtomethod = "wxPreCheckListBox:val._setOORInfo(val)"
671 bool IsChecked(int uiIndex);
672 void Check(int uiIndex, int bCheck = TRUE);
673 void InsertItems(int LCOUNT, wxString* choices, int pos);
680 //----------------------------------------------------------------------
687 wxTextAttr(const wxColour& colText = wxNullColour,
688 const wxColour& colBack = wxNullColour,
689 const wxFont& font = wxNullFont);
693 void SetTextColour(const wxColour& colText);
694 void SetBackgroundColour(const wxColour& colBack);
695 void SetFont(const wxFont& font);
698 bool HasTextColour() const;
699 bool HasBackgroundColour() const;
700 bool HasFont() const;
702 wxColour GetTextColour() const;
703 wxColour GetBackgroundColour() const;
704 wxFont GetFont() const;
706 // returns false if we have any attributes set, true otherwise
709 // return the attribute having the valid font and colours: it uses the
710 // attributes set in attr and falls back first to attrDefault and then to
711 // the text control font/colours for those attributes which are not set
712 static wxTextAttr Combine(const wxTextAttr& attr,
713 const wxTextAttr& attrDef,
714 const wxTextCtrl *text);
719 class wxTextCtrl : public wxControl {
721 wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
722 const wxPoint& pos = wxDefaultPosition,
723 const wxSize& size = wxDefaultSize,
725 const wxValidator& validator = wxDefaultValidator,
726 char* name = "text");
727 %name(wxPreTextCtrl)wxTextCtrl();
729 bool Create(wxWindow* parent, wxWindowID id, char* value = "",
730 const wxPoint& pos = wxDefaultPosition,
731 const wxSize& size = wxDefaultSize,
733 const wxValidator& validator = wxDefaultValidator,
734 char* name = "text");
736 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
737 %pragma(python) addtomethod = "wxPreTextCtrl:val._setOORInfo(val)"
740 wxString GetValue() const;
741 void SetValue(const wxString& value);
743 int GetLineLength(long lineNo) const;
744 wxString GetLineText(long lineNo) const;
745 int GetNumberOfLines() const;
747 bool IsModified() const;
748 bool IsEditable() const;
750 // If the return values from and to are the same, there is no selection.
751 void GetSelection(long* OUTPUT, long* OUTPUT) const;
752 wxString GetStringSelection();
755 void Replace(long from, long to, const wxString& value);
756 void Remove(long from, long to);
758 // load/save the controls contents from/to the file
759 bool LoadFile(const wxString& file);
760 bool SaveFile(const wxString& file = wxEmptyString);
762 // clears the dirty flag
765 // set the max number of characters which may be entered in a single line
767 void SetMaxLength(unsigned long len);
769 // writing text inserts it at the current position, appending always
770 // inserts it at the end
771 void WriteText(const wxString& text);
772 void AppendText(const wxString& text);
774 // text control under some platforms supports the text styles: these
775 // methods allow to apply the given text style to the given selection or to
776 // set/get the style which will be used for all appended text
777 bool SetStyle(long start, long end, const wxTextAttr& style);
778 bool SetDefaultStyle(const wxTextAttr& style);
779 const wxTextAttr& GetDefaultStyle() const;
781 // translate between the position (which is just an index in the text ctrl
782 // considering all its contents as a single strings) and (x, y) coordinates
783 // which represent column and line.
784 long XYToPosition(long x, long y) const;
785 bool PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const;
787 void ShowPosition(long pos);
789 // Clipboard operations
794 bool CanCopy() const;
796 bool CanPaste() const;
802 bool CanUndo() const;
803 bool CanRedo() const;
806 void SetInsertionPoint(long pos);
807 void SetInsertionPointEnd();
808 long GetInsertionPoint() const;
809 long GetLastPosition() const;
811 void SetSelection(long from, long to);
813 void SetEditable(bool editable);
816 void write(const wxString& text) {
817 self->AppendText(text);
821 // TODO: replace this when the method is really added to wxTextCtrl
823 wxString GetString(long from, long to) {
824 return self->GetValue().Mid(from, to-from);
829 //----------------------------------------------------------------------
831 class wxScrollBar : public wxControl {
833 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
834 const wxPoint& pos = wxDefaultPosition,
835 const wxSize& size = wxDefaultSize,
836 long style = wxSB_HORIZONTAL,
837 const wxValidator& validator = wxDefaultValidator,
838 char* name = "scrollBar");
839 %name(wxPreScrollBar)wxScrollBar();
841 bool Create(wxWindow* parent, wxWindowID id = -1,
842 const wxPoint& pos = wxDefaultPosition,
843 const wxSize& size = wxDefaultSize,
844 long style = wxSB_HORIZONTAL,
845 const wxValidator& validator = wxDefaultValidator,
846 char* name = "scrollBar");
848 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
849 %pragma(python) addtomethod = "wxPreScrollBar:val._setOORInfo(val)"
853 int GetThumbPosition();
855 %name(GetThumbLength) int GetThumbSize(); // to match the docs
859 void SetThumbPosition(int viewStart);
860 void SetScrollbar(int position, int thumbSize,
861 int range, int pageSize,
862 bool refresh = TRUE);
865 //----------------------------------------------------------------------
867 class wxSpinButton : public wxControl {
869 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
870 const wxPoint& pos = wxDefaultPosition,
871 const wxSize& size = wxDefaultSize,
872 long style = wxSP_HORIZONTAL,
873 char* name = "spinButton");
874 %name(wxPreSpinButton)wxSpinButton();
876 bool Create(wxWindow* parent, wxWindowID id = -1,
877 const wxPoint& pos = wxDefaultPosition,
878 const wxSize& size = wxDefaultSize,
879 long style = wxSP_HORIZONTAL,
880 char* name = "spinButton");
882 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
883 %pragma(python) addtomethod = "wxPreSpinButton:val._setOORInfo(val)"
888 void SetRange(int min, int max);
889 void SetValue(int value);
892 //----------------------------------------------------------------------
894 class wxStaticBitmap : public wxControl {
896 wxStaticBitmap(wxWindow* parent, wxWindowID id,
897 const wxBitmap& bitmap,
898 const wxPoint& pos = wxDefaultPosition,
899 const wxSize& size = wxDefaultSize,
901 char* name = "staticBitmap");
902 %name(wxPreStaticBitmap)wxStaticBitmap();
904 bool Create(wxWindow* parent, wxWindowID id,
905 const wxBitmap& bitmap,
906 const wxPoint& pos = wxDefaultPosition,
907 const wxSize& size = wxDefaultSize,
909 char* name = "staticBitmap");
911 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
912 %pragma(python) addtomethod = "wxPreStaticBitmap:val._setOORInfo(val)"
914 wxBitmap GetBitmap();
915 void SetBitmap(const wxBitmap& bitmap);
916 void SetIcon(const wxIcon& icon);
919 //----------------------------------------------------------------------
921 class wxRadioBox : public wxControl {
923 wxRadioBox(wxWindow* parent, wxWindowID id,
924 const wxString& label,
925 const wxPoint& point = wxDefaultPosition,
926 const wxSize& size = wxDefaultSize,
927 int LCOUNT = 0, wxString* choices = NULL,
928 int majorDimension = 0,
929 long style = wxRA_HORIZONTAL,
930 const wxValidator& validator = wxDefaultValidator,
931 char* name = "radioBox");
932 %name(wxPreRadioBox)wxRadioBox();
934 bool Create(wxWindow* parent, wxWindowID id,
935 const wxString& label,
936 const wxPoint& point = wxDefaultPosition,
937 const wxSize& size = wxDefaultSize,
938 int LCOUNT = 0, wxString* choices = NULL,
939 int majorDimension = 0,
940 long style = wxRA_HORIZONTAL,
941 const wxValidator& validator = wxDefaultValidator,
942 char* name = "radioBox");
944 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
945 %pragma(python) addtomethod = "wxPreRadioBox:val._setOORInfo(val)"
947 void Enable(bool enable);
948 %name(EnableItem)void Enable(int n, bool enable);
949 int FindString(const wxString& string);
951 wxString GetString(int n);
954 %name(GetItemLabel)wxString GetLabel( int item );
955 %name(SetItemLabel)void SetLabel( int item, const wxString& label );
957 void SetString(int n, const wxString& label);
958 %pragma(python) addtoclass = "
959 GetItemLabel = GetString
960 SetItemLabel = SetString
962 int GetColumnCount();
967 wxString GetStringSelection();
969 %pragma(python) addtoclass = "Number = GetCount"
971 void SetSelection(int n);
972 void SetStringSelection(const wxString& string);
973 void Show(bool show);
974 %name(ShowItem)void Show(int item, bool show);
977 //----------------------------------------------------------------------
979 class wxRadioButton : public wxControl {
981 wxRadioButton(wxWindow* parent, wxWindowID id,
982 const wxString& label,
983 const wxPoint& pos = wxDefaultPosition,
984 const wxSize& size = wxDefaultSize,
986 const wxValidator& validator = wxDefaultValidator,
987 char* name = "radioButton");
988 %name(wxPreRadioButton)wxRadioButton();
990 bool Create(wxWindow* parent, wxWindowID id,
991 const wxString& label,
992 const wxPoint& pos = wxDefaultPosition,
993 const wxSize& size = wxDefaultSize,
995 const wxValidator& validator = wxDefaultValidator,
996 char* name = "radioButton");
998 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
999 %pragma(python) addtomethod = "wxPreRadioButton:val._setOORInfo(val)"
1002 void SetValue(bool value);
1005 //----------------------------------------------------------------------
1007 class wxSlider : public wxControl {
1009 wxSlider(wxWindow* parent, wxWindowID id,
1010 int value, int minValue, int maxValue,
1011 const wxPoint& point = wxDefaultPosition,
1012 const wxSize& size = wxDefaultSize,
1013 long style = wxSL_HORIZONTAL,
1014 const wxValidator& validator = wxDefaultValidator,
1015 char* name = "slider");
1016 %name(wxPreSlider)wxSlider();
1018 bool Create(wxWindow* parent, wxWindowID id,
1019 int value, int minValue, int maxValue,
1020 const wxPoint& point = wxDefaultPosition,
1021 const wxSize& size = wxDefaultSize,
1022 long style = wxSL_HORIZONTAL,
1023 const wxValidator& validator = wxDefaultValidator,
1024 char* name = "slider");
1026 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
1027 %pragma(python) addtomethod = "wxPreSlider:val._setOORInfo(val)"
1037 int GetThumbLength();
1040 void SetRange(int minValue, int maxValue);
1041 void SetTickFreq(int n, int pos);
1042 void SetLineSize(int lineSize);
1043 void SetPageSize(int pageSize);
1044 void SetSelection(int startPos, int endPos);
1045 void SetThumbLength(int len);
1046 void SetTick(int tickPos);
1047 void SetValue(int value);
1051 //----------------------------------------------------------------------
1053 class wxSpinCtrl : public wxSpinButton {
1055 wxSpinCtrl(wxWindow *parent,
1057 const char* value = "",
1058 const wxPoint& pos = wxDefaultPosition,
1059 const wxSize& size = wxDefaultSize,
1060 long style = wxSP_ARROW_KEYS,
1061 int min = 0, int max = 100, int initial = 0,
1062 const char* name = "wxSpinCtrl");
1063 %name(wxPreSpinCtrl)wxSpinCtrl();
1065 bool Create(wxWindow *parent,
1067 const char* value = "",
1068 const wxPoint& pos = wxDefaultPosition,
1069 const wxSize& size = wxDefaultSize,
1070 long style = wxSP_ARROW_KEYS,
1071 int min = 0, int max = 100, int initial = 0,
1072 const char* name = "wxSpinCtrl");
1074 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
1075 %pragma(python) addtomethod = "wxPreSpinCtrl:val._setOORInfo(val)"
1080 void SetRange(int min, int max);
1081 void SetValue(int value);
1086 //----------------------------------------------------------------------
1089 enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, };
1091 class wxToggleButton : public wxControl {
1093 wxToggleButton(wxWindow *parent,
1095 const wxString& label,
1096 const wxPoint& pos = wxDefaultPosition,
1097 const wxSize& size = wxDefaultSize,
1099 const wxValidator& validator = wxDefaultValidator,
1100 const char* name = "toggle");
1101 %name(wxPreToggleButton)wxToggleButton();
1103 bool Create(wxWindow *parent,
1105 const wxString& label,
1106 const wxPoint& pos = wxDefaultPosition,
1107 const wxSize& size = wxDefaultSize,
1109 const wxValidator& validator = wxDefaultValidator,
1110 const char* name = "toggle");
1112 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
1113 %pragma(python) addtomethod = "wxPreToggleButton:val._setOORInfo(val)"
1115 void SetValue(bool value);
1116 bool GetValue() const ;
1117 void SetLabel(const wxString& label);
1122 //----------------------------------------------------------------------
1123 //----------------------------------------------------------------------
1124 //----------------------------------------------------------------------