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>
 
  35 //----------------------------------------------------------------------
 
  38 %include my_typemaps.i
 
  40 // Import some definitions of other classes, etc.
 
  47 %pragma(python) code = "import wx"
 
  49 //----------------------------------------------------------------------
 
  52 wxValidator wxDefaultValidator;
 
  55 //----------------------------------------------------------------------
 
  58 //#define DECLARE_DEF_STRING(name)  static wxString* wxPy##name
 
  60     // Put some wx default wxChar* values into wxStrings.
 
  61     DECLARE_DEF_STRING(ControlNameStr);
 
  62     DECLARE_DEF_STRING(ButtonNameStr);
 
  63     DECLARE_DEF_STRING(CheckBoxNameStr);
 
  64     DECLARE_DEF_STRING(ChoiceNameStr);
 
  65     DECLARE_DEF_STRING(ComboBoxNameStr);
 
  66     DECLARE_DEF_STRING(GaugeNameStr);
 
  67     DECLARE_DEF_STRING(StaticBoxNameStr);
 
  68     DECLARE_DEF_STRING(StaticTextNameStr);
 
  69     DECLARE_DEF_STRING(ListBoxNameStr);
 
  70     DECLARE_DEF_STRING(TextCtrlNameStr);
 
  71     DECLARE_DEF_STRING(ScrollBarNameStr);
 
  72     DECLARE_DEF_STRING(SPIN_BUTTON_NAME);
 
  73     DECLARE_DEF_STRING(StaticBitmapNameStr);
 
  74     DECLARE_DEF_STRING(RadioBoxNameStr);
 
  75     DECLARE_DEF_STRING(RadioButtonNameStr);
 
  76     DECLARE_DEF_STRING(SliderNameStr);
 
  78     wxChar* wxSpinCtrlNameStr = _T("wxSpinCtrl");
 
  79     DECLARE_DEF_STRING(SpinCtrlNameStr);
 
  81     static const wxString wxPyEmptyString(wxT(""));
 
  84 //----------------------------------------------------------------------
 
  86 //  This is the base class for a control or 'widget'.
 
  88 //  A control is generally a small window which processes user input and/or
 
  89 //  displays one or more item of data.
 
  90 class wxControl : public wxWindow {
 
  94     wxControl(wxWindow *parent,
 
  96               const wxPoint& pos=wxDefaultPosition,
 
  97               const wxSize& size=wxDefaultSize,
 
  99               const wxValidator& validator=wxDefaultValidator,
 
 100               const wxString& name=wxPyControlNameStr);
 
 103     %name(wxPreControl)wxControl();
 
 106     bool Create(wxWindow *parent,
 
 108                        const wxPoint& pos=wxDefaultPosition,
 
 109                        const wxSize& size=wxDefaultSize,
 
 111                        const wxValidator& validator=wxDefaultValidator,
 
 112                        const wxString& name=wxPyControlNameStr);
 
 114     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 115     %pragma(python) addtomethod = "wxPreControl:val._setOORInfo(val)"
 
 117     // Simulates the effect of the user issuing a command to the item. See
 
 119     void Command(wxCommandEvent& event);
 
 121     // Return a control's text.
 
 124     // Sets the item's text.
 
 125     void SetLabel(const wxString& label);
 
 129 //----------------------------------------------------------------------
 
 132 class wxControlWithItems : public wxControl {
 
 135     // void Clear();  ambiguous, redefine below...
 
 137     // Deletes an item from the control
 
 140     // Returns the number of items in the control.
 
 142     %pragma(python) addtoclass = "Number = GetCount"
 
 144     // Returns the string at the given position.
 
 145     wxString GetString(int n);
 
 147     // Sets the string value of an item.
 
 148     void SetString(int n, const wxString& s);
 
 150     // Finds an item matching the given string.  Returns the zero-based
 
 151     // position of the item, or -1 if the string was not found.
 
 152     int FindString(const wxString& s);
 
 154     // Select the item at postion n.
 
 157     // Gets the position of the selected item.
 
 160     // Gets the current selection as a string.
 
 161     wxString GetStringSelection() const;
 
 163     //   void Append(const wxString& item);
 
 164     //   void Append(const wxString& item, char* clientData);
 
 165     //   char* GetClientData(const int n);
 
 166     //   void SetClientData(const int n, char* data);
 
 170         // Adds the item to the control, associating the given data with the
 
 172         void Append(const wxString& item, PyObject* clientData=NULL) {
 
 174                 wxPyClientData* data = new wxPyClientData(clientData);
 
 175                 self->Append(item, data);
 
 180         // Returns the client data associated with the given item, (if any.)
 
 181         PyObject* GetClientData(int n) {
 
 182             wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
 
 184                 Py_INCREF(data->m_obj);
 
 192         // Associate the given client data with the item at position n.
 
 193         void SetClientData(int n, PyObject* clientData) {
 
 194             wxPyClientData* data = new wxPyClientData(clientData);
 
 195             self->SetClientObject(n, data);
 
 199     // append several items at once to the control
 
 200     %name(AppendItems)void Append(const wxArrayString& strings);
 
 204 //----------------------------------------------------------------------
 
 206 // A button is a control that contains a text string, and is one of the most
 
 207 // common elements of a GUI.  It may be placed on a dialog box or panel, or
 
 208 // indeed almost any other window.
 
 211 //    wxBU_LEFT:  Left-justifies the label. WIN32 only.
 
 212 //    wxBU_TOP:  Aligns the label to the top of the button. WIN32 only.
 
 213 //    wxBU_RIGHT:  Right-justifies the bitmap label. WIN32 only.
 
 214 //    wxBU_BOTTOM:  Aligns the label to the bottom of the button. WIN32 only.
 
 215 //    wxBU_EXACTFIT: Creates the button as small as possible instead of making
 
 216 //                   it of the standard size (which is the default behaviour.)
 
 219 //     EVT_BUTTON(win,id,func):
 
 220 //         Sent when the button is clicked.
 
 222 class wxButton : public wxControl {
 
 224     // Constructor, creating and showing a button.
 
 226     // parent:  Parent window.  Must not be None.
 
 227     // id:      Button identifier.  A value of -1 indicates a default value.
 
 228     // label:   The text to be displayed on the button.
 
 229     // pos:     The button position on it's parent.
 
 230     // size:    Button size.  If the default size (-1, -1) is specified then the
 
 231     //          button is sized appropriately for the text.
 
 232     // style:   Window style.  See wxButton.
 
 233     // validator: Window validator.
 
 234     // name:    Window name.
 
 235     wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
 
 236              const wxPoint& pos = wxDefaultPosition,
 
 237              const wxSize& size = wxDefaultSize,
 
 239              const wxValidator& validator = wxDefaultValidator,
 
 240              const wxString& name = wxPyButtonNameStr);
 
 242     // Default constructor
 
 243     %name(wxPreButton)wxButton();
 
 245     // Button creation function for two-step creation.
 
 246     bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
 
 247              const wxPoint& pos = wxDefaultPosition,
 
 248              const wxSize& size = wxDefaultSize,
 
 250              const wxValidator& validator = wxDefaultValidator,
 
 251              const wxString& name = wxPyButtonNameStr);
 
 253     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 254     %pragma(python) addtomethod = "wxPreButton:val._setOORInfo(val)"
 
 256     // This sets the button to be the default item for the panel or dialog box.
 
 258     // Under Windows, only dialog box buttons respond to this function. As
 
 259     // normal under Windows and Motif, pressing return causes the default
 
 260     // button to be depressed when the return key is pressed. See also
 
 261     // wxWindow.SetFocus which sets the keyboard focus for windows and text
 
 262     // panel items, and wxPanel.SetDefaultItem.
 
 266     void SetBackgroundColour(const wxColour& colour);
 
 268     void SetForegroundColour(const wxColour& colour);
 
 271     // show the image in the button in addition to the label
 
 272     void SetImageLabel(const wxBitmap& bitmap);
 
 274     // set the margins around the image
 
 275     void SetImageMargins(wxCoord x, wxCoord y);
 
 278     // returns the default button size for this platform
 
 279     static wxSize GetDefaultSize();
 
 282 //----------------------------------------------------------------------
 
 284 class wxBitmapButton : public wxButton {
 
 286     wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
 
 287                    const wxPoint& pos = wxDefaultPosition,
 
 288                    const wxSize& size = wxDefaultSize,
 
 289                    long style = wxBU_AUTODRAW,
 
 290                    const wxValidator& validator = wxDefaultValidator,
 
 291                    const wxString& name = wxPyButtonNameStr);
 
 292     %name(wxPreBitmapButton)wxBitmapButton();
 
 294     bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
 
 295                    const wxPoint& pos = wxDefaultPosition,
 
 296                    const wxSize& size = wxDefaultSize,
 
 297                    long style = wxBU_AUTODRAW,
 
 298                    const wxValidator& validator = wxDefaultValidator,
 
 299                 const wxString& name = wxPyButtonNameStr);
 
 301     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 302     %pragma(python) addtomethod = "wxPreBitmapButton:val._setOORInfo(val)"
 
 304     wxBitmap GetBitmapLabel();
 
 305     wxBitmap GetBitmapDisabled();
 
 306     wxBitmap GetBitmapFocus();
 
 307     wxBitmap GetBitmapSelected();
 
 308     void SetBitmapDisabled(const wxBitmap& bitmap);
 
 309     void SetBitmapFocus(const wxBitmap& bitmap);
 
 310     void SetBitmapSelected(const wxBitmap& bitmap);
 
 311     void SetBitmapLabel(const wxBitmap& bitmap);
 
 313     void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
 
 314     int GetMarginX() const { return m_marginX; }
 
 315     int GetMarginY() const { return m_marginY; }
 
 318 //----------------------------------------------------------------------
 
 320 class wxCheckBox : public wxControl {
 
 322     wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
 
 323                const wxPoint& pos = wxDefaultPosition,
 
 324                const wxSize& size = wxDefaultSize,
 
 326                const wxValidator& val = wxDefaultValidator,
 
 327                const wxString& name = wxPyCheckBoxNameStr);
 
 328     %name(wxPreCheckBox)wxCheckBox();
 
 330     bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
 
 331                const wxPoint& pos = wxDefaultPosition,
 
 332                const wxSize& size = wxDefaultSize,
 
 334                const wxValidator& val = wxDefaultValidator,
 
 335                const wxString& name = wxPyCheckBoxNameStr);
 
 337     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 338     %pragma(python) addtomethod = "wxPreCheckBox:val._setOORInfo(val)"
 
 342     void SetValue(const bool state);
 
 345 //----------------------------------------------------------------------
 
 347 class wxChoice : public wxControlWithItems {
 
 349     wxChoice(wxWindow *parent, wxWindowID id,
 
 350              const wxPoint& pos = wxDefaultPosition,
 
 351              const wxSize& size = wxDefaultSize,
 
 352              int LCOUNT=0, wxString* choices=NULL,
 
 354              const wxValidator& validator = wxDefaultValidator,
 
 355              const wxString& name = wxPyChoiceNameStr);
 
 356     %name(wxPreChoice)wxChoice();
 
 358     bool Create(wxWindow *parent, wxWindowID id,
 
 359              const wxPoint& pos = wxDefaultPosition,
 
 360              const wxSize& size = wxDefaultSize,
 
 361              int LCOUNT=0, wxString* choices=NULL,
 
 363              const wxValidator& validator = wxDefaultValidator,
 
 364              const wxString& name = wxPyChoiceNameStr);
 
 366     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 367     %pragma(python) addtomethod = "wxPreChoice:val._setOORInfo(val)"
 
 372     void SetColumns(const int n = 1);
 
 373     void SetSelection(const int n);
 
 374     void SetStringSelection(const wxString& string);
 
 375     void SetString(int n, const wxString& s);
 
 377     %pragma(python) addtoclass = "
 
 378     Select = SetSelection
 
 382 //----------------------------------------------------------------------
 
 384 // wxGTK's wxComboBox doesn't derive from wxChoice like wxMSW, or
 
 385 // even wxControlWithItems, so we have to duplicate the methods
 
 389 class wxComboBox : public wxControl
 
 392     wxComboBox(wxWindow* parent, wxWindowID id,
 
 393                const wxString& value = wxPyEmptyString,
 
 394                const wxPoint& pos = wxDefaultPosition,
 
 395                const wxSize& size = wxDefaultSize,
 
 396                int LCOUNT=0, wxString* choices=NULL,
 
 398                const wxValidator& validator = wxDefaultValidator,
 
 399                const wxString& name = wxPyComboBoxNameStr);
 
 400     %name(wxPreComboBox)wxComboBox();
 
 402     bool Create(wxWindow* parent, wxWindowID id,
 
 403                 const wxString& value = wxPyEmptyString,
 
 404                 const wxPoint& pos = wxDefaultPosition,
 
 405                 const wxSize& size = wxDefaultSize,
 
 406                 int LCOUNT=0, wxString* choices=NULL,
 
 408                 const wxValidator& validator = wxDefaultValidator,
 
 409                 const wxString& name = wxPyComboBoxNameStr);
 
 411     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 412     %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)"
 
 416     long GetInsertionPoint();
 
 417     long GetLastPosition();
 
 420     void Replace(long from, long to, const wxString& text);
 
 421     void Remove(long from, long to);
 
 422     void SetInsertionPoint(long pos);
 
 423     void SetInsertionPointEnd();
 
 424     void SetSelection(int n);
 
 425     %name(SetMark)void SetSelection(long from, long to);
 
 426     void SetValue(const wxString& text);
 
 427     void SetEditable(bool editable);
 
 434     %pragma(python) addtoclass = "Number = GetCount"
 
 435     wxString GetString(int n);
 
 436     int FindString(const wxString& s);
 
 438     //void SetString(int n, const wxString& s);  *** No equivalent for wxGTK!!!
 
 440     // void Select(int n);
 
 441     %pragma(python) addtoclass = "Select = SetSelection"
 
 444     wxString GetStringSelection() const;
 
 446     //   void Append(const wxString& item);
 
 447     //   void Append(const wxString& item, char* clientData);
 
 448     //   char* GetClientData(const int n);
 
 449     //   void SetClientData(const int n, char* data);
 
 451         void Append(const wxString& item, PyObject* clientData=NULL) {
 
 453                 wxPyClientData* data = new wxPyClientData(clientData);
 
 454                 self->Append(item, data);
 
 459         PyObject* GetClientData(int n) {
 
 460             wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
 
 462                 Py_INCREF(data->m_obj);
 
 470         void SetClientData(int n, PyObject* clientData) {
 
 471             wxPyClientData* data = new wxPyClientData(clientData);
 
 472             self->SetClientObject(n, data);
 
 480 #else  // For all but wxGTK
 
 483 class wxComboBox : public wxChoice {
 
 485     wxComboBox(wxWindow* parent, wxWindowID id,
 
 486                const wxString& value = wxPyEmptyString,
 
 487                const wxPoint& pos = wxDefaultPosition,
 
 488                const wxSize& size = wxDefaultSize,
 
 489                int LCOUNT=0, wxString* choices=NULL,
 
 491                const wxValidator& validator = wxDefaultValidator,
 
 492                const wxString& name = wxPyComboBoxNameStr);
 
 493     %name(wxPreComboBox)wxComboBox();
 
 495     bool Create(wxWindow* parent, wxWindowID id,
 
 496                const wxString& value = wxPyEmptyString,
 
 497                const wxPoint& pos = wxDefaultPosition,
 
 498                const wxSize& size = wxDefaultSize,
 
 499                int LCOUNT=0, wxString* choices=NULL,
 
 501                const wxValidator& validator = wxDefaultValidator,
 
 502                const wxString& name = wxPyComboBoxNameStr);
 
 504     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 505     %pragma(python) addtomethod = "wxPreComboBox:val._setOORInfo(val)"
 
 509     long GetInsertionPoint();
 
 510     long GetLastPosition();
 
 513     void Replace(long from, long to, const wxString& text);
 
 514     void Remove(long from, long to);
 
 515     void SetInsertionPoint(long pos);
 
 516     void SetInsertionPointEnd();
 
 517     void SetSelection(int n);
 
 518     %name(SetMark)void SetSelection(long from, long to);
 
 519     void SetValue(const wxString& text);
 
 520     void SetEditable(bool editable);
 
 525 //----------------------------------------------------------------------
 
 527 class wxGauge : public wxControl {
 
 529     wxGauge(wxWindow* parent, wxWindowID id, int range,
 
 530             const wxPoint& pos = wxDefaultPosition,
 
 531             const wxSize& size = wxDefaultSize,
 
 532             long style = wxGA_HORIZONTAL,
 
 533             const wxValidator& validator = wxDefaultValidator,
 
 534             const wxString& name = wxPyGaugeNameStr);
 
 535     %name(wxPreGauge)wxGauge();
 
 537     bool Create(wxWindow* parent, wxWindowID id, int range,
 
 538             const wxPoint& pos = wxDefaultPosition,
 
 539             const wxSize& size = wxDefaultSize,
 
 540             long style = wxGA_HORIZONTAL,
 
 541             const wxValidator& validator = wxDefaultValidator,
 
 542             const wxString& name = wxPyGaugeNameStr);
 
 544     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 545     %pragma(python) addtomethod = "wxPreGauge:val._setOORInfo(val)"
 
 549     int GetShadowWidth();
 
 551     void SetBezelFace(int width);
 
 552     void SetRange(int range);
 
 553     void SetShadowWidth(int width);
 
 554     void SetValue(int pos);
 
 557 //----------------------------------------------------------------------
 
 559 class wxStaticBox : public wxControl {
 
 561     wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
 
 562                 const wxPoint& pos = wxDefaultPosition,
 
 563                 const wxSize& size = wxDefaultSize,
 
 565                 const wxString& name = wxPyStaticBoxNameStr);
 
 566     %name(wxPreStaticBox)wxStaticBox();
 
 568     bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
 
 569                 const wxPoint& pos = wxDefaultPosition,
 
 570                 const wxSize& size = wxDefaultSize,
 
 572                 const wxString& name = wxPyStaticBoxNameStr);
 
 574     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 575     %pragma(python) addtomethod = "wxPreStaticBox:val._setOORInfo(val)"
 
 579 //----------------------------------------------------------------------
 
 582 class wxStaticLine : public wxControl {
 
 584     wxStaticLine( wxWindow *parent, wxWindowID id,
 
 585                   const wxPoint &pos = wxDefaultPosition,
 
 586                   const wxSize &size = wxDefaultSize,
 
 587                   long style = wxLI_HORIZONTAL,
 
 588                   const wxString& name = wxPyStaticTextNameStr);
 
 589     %name(wxPreStaticLine)wxStaticLine();
 
 591     bool Create( wxWindow *parent, wxWindowID id,
 
 592                   const wxPoint &pos = wxDefaultPosition,
 
 593                   const wxSize &size = wxDefaultSize,
 
 594                   long style = wxLI_HORIZONTAL,
 
 595                   const wxString& name = wxPyStaticTextNameStr);
 
 597     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 598     %pragma(python) addtomethod = "wxPreStaticLine:val._setOORInfo(val)"
 
 602 //----------------------------------------------------------------------
 
 604 class wxStaticText : public wxControl {
 
 606     wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
 
 607                  const wxPoint& pos = wxDefaultPosition,
 
 608                  const wxSize& size = wxDefaultSize,
 
 610                  const wxString& name = wxPyStaticTextNameStr);
 
 611     %name(wxPreStaticText)wxStaticText();
 
 613     bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
 
 614                  const wxPoint& pos = wxDefaultPosition,
 
 615                  const wxSize& size = wxDefaultSize,
 
 617                  const wxString& name = wxPyStaticTextNameStr);
 
 619     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 620     %pragma(python) addtomethod = "wxPreStaticText:val._setOORInfo(val)"
 
 623     void SetLabel(const wxString& label);
 
 626 //----------------------------------------------------------------------
 
 628 class wxListBox : public wxControlWithItems {
 
 630     wxListBox(wxWindow* parent, wxWindowID id,
 
 631               const wxPoint& pos = wxDefaultPosition,
 
 632               const wxSize& size = wxDefaultSize,
 
 633               int LCOUNT, wxString* choices = NULL,
 
 635               const wxValidator& validator = wxDefaultValidator,
 
 636               const wxString& name = wxPyListBoxNameStr);
 
 637     %name(wxPreListBox)wxListBox();
 
 639     bool Create(wxWindow* parent, wxWindowID id,
 
 640               const wxPoint& pos = wxDefaultPosition,
 
 641               const wxSize& size = wxDefaultSize,
 
 642               int LCOUNT, wxString* choices = NULL,
 
 644               const wxValidator& validator = wxDefaultValidator,
 
 645               const wxString& name = wxPyListBoxNameStr);
 
 647     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 648     %pragma(python) addtomethod = "wxPreListBox:val._setOORInfo(val)"
 
 651     void Deselect(int n);
 
 653     // int GetSelections(int **selections);
 
 655       PyObject* GetSelections() {
 
 657           self->GetSelections(lst);
 
 658           PyObject *tup = PyTuple_New(lst.GetCount());
 
 659           for(size_t i=0; i<lst.GetCount(); i++) {
 
 660               PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
 
 667     void InsertItems(int LCOUNT, wxString* choices, int pos);
 
 669     bool IsSelected(const int n);
 
 670     bool Selected(const int n);
 
 671     void Set(int LCOUNT, wxString* choices);
 
 672     void SetFirstItem(int n);
 
 673     %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
 
 674     void SetSelection(int n, bool select = TRUE);
 
 675     void SetString(int n, const wxString& string);
 
 676     void SetStringSelection(const wxString& string, bool select = TRUE);
 
 680 //----------------------------------------------------------------------
 
 682 class wxCheckListBox : public wxListBox {
 
 684     wxCheckListBox(wxWindow *parent, wxWindowID id,
 
 685                    const wxPoint& pos = wxDefaultPosition,
 
 686                    const wxSize& size = wxDefaultSize,
 
 688                    wxString* choices = NULL,
 
 690                    const wxValidator& validator = wxDefaultValidator,
 
 691                    const wxString& name = wxPyListBoxNameStr);
 
 692     %name(wxPreCheckListBox)wxCheckListBox();
 
 694     bool Create(wxWindow *parent, wxWindowID id,
 
 695                    const wxPoint& pos = wxDefaultPosition,
 
 696                    const wxSize& size = wxDefaultSize,
 
 698                    wxString* choices = NULL,
 
 700                    const wxValidator& validator = wxDefaultValidator,
 
 701                    const wxString& name = wxPyListBoxNameStr);
 
 703     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 704     %pragma(python) addtomethod = "wxPreCheckListBox:val._setOORInfo(val)"
 
 706     bool  IsChecked(int uiIndex);
 
 707     void  Check(int uiIndex, int bCheck = TRUE);
 
 708     void InsertItems(int LCOUNT, wxString* choices, int pos);
 
 714     // return the index of the item at this position or wxNOT_FOUND
 
 715     int HitTest(const wxPoint& pt) const;
 
 716     %name(HitTestXY)int HitTest(wxCoord x, wxCoord y) const;
 
 720 //----------------------------------------------------------------------
 
 727     wxTextAttr(const wxColour& colText = wxNullColour,
 
 728                const wxColour& colBack = wxNullColour,
 
 729                const wxFont& font = wxNullFont);
 
 733     void SetTextColour(const wxColour& colText);
 
 734     void SetBackgroundColour(const wxColour& colBack);
 
 735     void SetFont(const wxFont& font);
 
 738     bool HasTextColour() const;
 
 739     bool HasBackgroundColour() const;
 
 740     bool HasFont() const;
 
 742     wxColour GetTextColour() const;
 
 743     wxColour GetBackgroundColour() const;
 
 744     wxFont GetFont() const;
 
 746     // returns false if we have any attributes set, true otherwise
 
 749     // return the attribute having the valid font and colours: it uses the
 
 750     // attributes set in attr and falls back first to attrDefault and then to
 
 751     // the text control font/colours for those attributes which are not set
 
 752     static wxTextAttr Combine(const wxTextAttr& attr,
 
 753                               const wxTextAttr& attrDef,
 
 754                               const wxTextCtrl *text);
 
 759 class wxTextCtrl : public wxControl {
 
 761     wxTextCtrl(wxWindow* parent, wxWindowID id,
 
 762                const wxString& value = wxPyEmptyString,
 
 763                const wxPoint& pos = wxDefaultPosition,
 
 764                const wxSize& size = wxDefaultSize,
 
 766                const wxValidator& validator = wxDefaultValidator,
 
 767                const wxString& name = wxPyTextCtrlNameStr);
 
 768     %name(wxPreTextCtrl)wxTextCtrl();
 
 770     bool Create(wxWindow* parent, wxWindowID id,
 
 771                const wxString& value = wxPyEmptyString,
 
 772                const wxPoint& pos = wxDefaultPosition,
 
 773                const wxSize& size = wxDefaultSize,
 
 775                const wxValidator& validator = wxDefaultValidator,
 
 776                const wxString& name = wxPyTextCtrlNameStr);
 
 778     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 779     %pragma(python) addtomethod = "wxPreTextCtrl:val._setOORInfo(val)"
 
 782     wxString GetValue() const;
 
 783     void SetValue(const wxString& value);
 
 785     wxString GetRange(long from, long to);
 
 787     int GetLineLength(long lineNo) const;
 
 788     wxString GetLineText(long lineNo) const;
 
 789     int GetNumberOfLines() const;
 
 791     bool IsModified() const;
 
 792     bool IsEditable() const;
 
 794     // If the return values from and to are the same, there is no selection.
 
 795     void GetSelection(long* OUTPUT, long* OUTPUT) const;
 
 796     wxString GetStringSelection();
 
 799     void Replace(long from, long to, const wxString& value);
 
 800     void Remove(long from, long to);
 
 802     // load/save the controls contents from/to the file
 
 803     bool LoadFile(const wxString& file);
 
 804     bool SaveFile(const wxString& file = wxPyEmptyString);
 
 806     // clears the dirty flag
 
 809     // set the max number of characters which may be entered in a single line
 
 811     void SetMaxLength(unsigned long len);
 
 813     // writing text inserts it at the current position, appending always
 
 814     // inserts it at the end
 
 815     void WriteText(const wxString& text);
 
 816     void AppendText(const wxString& text);
 
 818     // insert the character which would have resulted from this key event,
 
 819     // return TRUE if anything has been inserted
 
 820     bool EmulateKeyPress(const wxKeyEvent& event);
 
 822     // text control under some platforms supports the text styles: these
 
 823     // methods allow to apply the given text style to the given selection or to
 
 824     // set/get the style which will be used for all appended text
 
 825     bool SetStyle(long start, long end, const wxTextAttr& style);
 
 826     bool SetDefaultStyle(const wxTextAttr& style);
 
 827     const wxTextAttr& GetDefaultStyle() const;
 
 829     // translate between the position (which is just an index in the text ctrl
 
 830     // considering all its contents as a single strings) and (x, y) coordinates
 
 831     // which represent column and line.
 
 832     long XYToPosition(long x, long y) const;
 
 833     void PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const;
 
 835     //bool PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const;
 
 836     // TODO: check return value, raise exception.
 
 838     void ShowPosition(long pos);
 
 840     // Clipboard operations
 
 845     bool CanCopy() const;
 
 847     bool CanPaste() const;
 
 853     bool CanUndo() const;
 
 854     bool CanRedo() const;
 
 857     void SetInsertionPoint(long pos);
 
 858     void SetInsertionPointEnd();
 
 859     long GetInsertionPoint() const;
 
 860     long GetLastPosition() const;
 
 862     void SetSelection(long from, long to);
 
 864     void SetEditable(bool editable);
 
 871         void write(const wxString& text) {
 
 872             self->AppendText(text);
 
 876     // TODO: replace this when the method is really added to wxTextCtrl
 
 878         wxString GetString(long from, long to) {
 
 879             return self->GetValue().Mid(from, to - from);
 
 884 //----------------------------------------------------------------------
 
 886 class wxScrollBar : public wxControl {
 
 888     wxScrollBar(wxWindow* parent, wxWindowID id = -1,
 
 889                 const wxPoint& pos = wxDefaultPosition,
 
 890                 const wxSize& size = wxDefaultSize,
 
 891                 long style = wxSB_HORIZONTAL,
 
 892                 const wxValidator& validator = wxDefaultValidator,
 
 893                 const wxString& name = wxPyScrollBarNameStr);
 
 894     %name(wxPreScrollBar)wxScrollBar();
 
 896     bool Create(wxWindow* parent, wxWindowID id = -1,
 
 897                 const wxPoint& pos = wxDefaultPosition,
 
 898                 const wxSize& size = wxDefaultSize,
 
 899                 long style = wxSB_HORIZONTAL,
 
 900                 const wxValidator& validator = wxDefaultValidator,
 
 901                 const wxString& name = wxPyScrollBarNameStr);
 
 903     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 904     %pragma(python) addtomethod = "wxPreScrollBar:val._setOORInfo(val)"
 
 908     int GetThumbPosition();
 
 910     %name(GetThumbLength) int GetThumbSize();  // to match the docs
 
 914     void SetThumbPosition(int viewStart);
 
 915     void SetScrollbar(int position, int thumbSize,
 
 916                       int range,    int pageSize,
 
 917                       bool refresh = TRUE);
 
 920 //----------------------------------------------------------------------
 
 922 class wxSpinButton : public wxControl {
 
 924     wxSpinButton(wxWindow* parent, wxWindowID id = -1,
 
 925                  const wxPoint& pos = wxDefaultPosition,
 
 926                  const wxSize& size = wxDefaultSize,
 
 927                  long style = wxSP_HORIZONTAL,
 
 928                  const wxString& name = wxPySPIN_BUTTON_NAME);
 
 929     %name(wxPreSpinButton)wxSpinButton();
 
 931     bool Create(wxWindow* parent, wxWindowID id = -1,
 
 932                  const wxPoint& pos = wxDefaultPosition,
 
 933                  const wxSize& size = wxDefaultSize,
 
 934                  long style = wxSP_HORIZONTAL,
 
 935                  const wxString& name = wxPySPIN_BUTTON_NAME);
 
 937     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 938     %pragma(python) addtomethod = "wxPreSpinButton:val._setOORInfo(val)"
 
 943     void SetRange(int min, int max);
 
 944     void SetValue(int value);
 
 947 //----------------------------------------------------------------------
 
 949 class wxStaticBitmap : public wxControl {
 
 951     wxStaticBitmap(wxWindow* parent, wxWindowID id,
 
 952                    const wxBitmap& bitmap,
 
 953                    const wxPoint& pos = wxDefaultPosition,
 
 954                    const wxSize& size = wxDefaultSize,
 
 956                    const wxString& name = wxPyStaticBitmapNameStr);
 
 957     %name(wxPreStaticBitmap)wxStaticBitmap();
 
 959     bool Create(wxWindow* parent, wxWindowID id,
 
 960                    const wxBitmap& bitmap,
 
 961                    const wxPoint& pos = wxDefaultPosition,
 
 962                    const wxSize& size = wxDefaultSize,
 
 964                    const wxString& name = wxPyStaticBitmapNameStr);
 
 966     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 967     %pragma(python) addtomethod = "wxPreStaticBitmap:val._setOORInfo(val)"
 
 969     wxBitmap GetBitmap();
 
 970     void SetBitmap(const wxBitmap& bitmap);
 
 971     void SetIcon(const wxIcon& icon);
 
 974 //----------------------------------------------------------------------
 
 976 class wxRadioBox : public wxControl {
 
 978     wxRadioBox(wxWindow* parent, wxWindowID id,
 
 979                const wxString& label,
 
 980                const wxPoint& point = wxDefaultPosition,
 
 981                const wxSize& size = wxDefaultSize,
 
 982                int LCOUNT = 0, wxString* choices = NULL,
 
 983                int majorDimension = 0,
 
 984                long style = wxRA_HORIZONTAL,
 
 985                const wxValidator& validator = wxDefaultValidator,
 
 986                const wxString& name = wxPyRadioBoxNameStr);
 
 987     %name(wxPreRadioBox)wxRadioBox();
 
 989     bool Create(wxWindow* parent, wxWindowID id,
 
 990                const wxString& label,
 
 991                const wxPoint& point = wxDefaultPosition,
 
 992                const wxSize& size = wxDefaultSize,
 
 993                int LCOUNT = 0, wxString* choices = NULL,
 
 994                int majorDimension = 0,
 
 995                long style = wxRA_HORIZONTAL,
 
 996                const wxValidator& validator = wxDefaultValidator,
 
 997                const wxString& name = wxPyRadioBoxNameStr);
 
 999     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
1000     %pragma(python) addtomethod = "wxPreRadioBox:val._setOORInfo(val)"
 
1002     void Enable(bool enable);
 
1003     %name(EnableItem)void Enable(int n, bool enable);
 
1004     int FindString(const wxString& string);
 
1006     wxString GetString(int n);
 
1007     void SetString(int n, const wxString& label);
 
1008     %pragma(python) addtoclass = "
 
1009     GetItemLabel = GetString
 
1010     SetItemLabel = SetString
 
1013     int GetColumnCount();
 
1015     int GetNextItem(int item, wxDirection dir, long style);
 
1019     wxString GetStringSelection();
 
1021     %pragma(python) addtoclass = "Number = GetCount"
 
1023     void SetSelection(int n);
 
1024     void SetStringSelection(const wxString& string);
 
1025     void Show(bool show);
 
1026     %name(ShowItem)void Show(int item, bool show);
 
1029 //----------------------------------------------------------------------
 
1031 class wxRadioButton : public wxControl {
 
1033     wxRadioButton(wxWindow* parent, wxWindowID id,
 
1034                   const wxString& label,
 
1035                   const wxPoint& pos = wxDefaultPosition,
 
1036                   const wxSize& size = wxDefaultSize,
 
1038                   const wxValidator& validator = wxDefaultValidator,
 
1039                   const wxString& name = wxPyRadioButtonNameStr);
 
1040     %name(wxPreRadioButton)wxRadioButton();
 
1042     bool Create(wxWindow* parent, wxWindowID id,
 
1043                   const wxString& label,
 
1044                   const wxPoint& pos = wxDefaultPosition,
 
1045                   const wxSize& size = wxDefaultSize,
 
1047                   const wxValidator& validator = wxDefaultValidator,
 
1048                   const wxString& name = wxPyRadioButtonNameStr);
 
1050     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
1051     %pragma(python) addtomethod = "wxPreRadioButton:val._setOORInfo(val)"
 
1054     void SetValue(bool value);
 
1057 //----------------------------------------------------------------------
 
1059 class wxSlider : public wxControl {
 
1061     wxSlider(wxWindow* parent, wxWindowID id,
 
1062              int value, int minValue, int maxValue,
 
1063              const wxPoint& point = wxDefaultPosition,
 
1064              const wxSize& size = wxDefaultSize,
 
1065              long style = wxSL_HORIZONTAL,
 
1066              const wxValidator& validator = wxDefaultValidator,
 
1067              const wxString& name = wxPySliderNameStr);
 
1068     %name(wxPreSlider)wxSlider();
 
1070     bool Create(wxWindow* parent, wxWindowID id,
 
1071              int value, int minValue, int maxValue,
 
1072              const wxPoint& point = wxDefaultPosition,
 
1073              const wxSize& size = wxDefaultSize,
 
1074              long style = wxSL_HORIZONTAL,
 
1075              const wxValidator& validator = wxDefaultValidator,
 
1076              const wxString& name = wxPySliderNameStr);
 
1078     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
1079     %pragma(python) addtomethod = "wxPreSlider:val._setOORInfo(val)"
 
1089     int GetThumbLength();
 
1092     void SetRange(int minValue, int maxValue);
 
1093     void SetTickFreq(int n, int pos);
 
1094     void SetLineSize(int lineSize);
 
1095     void SetPageSize(int pageSize);
 
1096     void SetSelection(int startPos, int endPos);
 
1097     void SetThumbLength(int len);
 
1098     void SetTick(int tickPos);
 
1099     void SetValue(int value);
 
1103 //----------------------------------------------------------------------
 
1105 class wxSpinCtrl : public wxSpinButton {
 
1107     wxSpinCtrl(wxWindow *parent,
 
1109                const wxString& value = wxPyEmptyString,
 
1110                const wxPoint& pos = wxDefaultPosition,
 
1111                const wxSize& size = wxDefaultSize,
 
1112                long style = wxSP_ARROW_KEYS,
 
1113                int min = 0, int max = 100, int initial = 0,
 
1114                const wxString& name = wxPySpinCtrlNameStr);
 
1115     %name(wxPreSpinCtrl)wxSpinCtrl();
 
1117     bool Create(wxWindow *parent,
 
1119                const wxString& value = wxPyEmptyString,
 
1120                const wxPoint& pos = wxDefaultPosition,
 
1121                const wxSize& size = wxDefaultSize,
 
1122                long style = wxSP_ARROW_KEYS,
 
1123                int min = 0, int max = 100, int initial = 0,
 
1124                const wxString& name = wxPySpinCtrlNameStr);
 
1126     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
1127     %pragma(python) addtomethod = "wxPreSpinCtrl:val._setOORInfo(val)"
 
1132     void SetRange(int min, int max);
 
1133     void SetValue(int value);
 
1138 //----------------------------------------------------------------------
 
1141 enum { wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, };
 
1143 class wxToggleButton : public wxControl {
 
1145     wxToggleButton(wxWindow *parent,
 
1147                    const wxString& label,
 
1148                    const wxPoint& pos = wxDefaultPosition,
 
1149                    const wxSize& size = wxDefaultSize,
 
1151                    const wxValidator& validator = wxDefaultValidator,
 
1152                    const wxString& name = wxPyCheckBoxNameStr);
 
1153     %name(wxPreToggleButton)wxToggleButton();
 
1155     bool Create(wxWindow *parent,
 
1157                    const wxString& label,
 
1158                    const wxPoint& pos = wxDefaultPosition,
 
1159                    const wxSize& size = wxDefaultSize,
 
1161                    const wxValidator& validator = wxDefaultValidator,
 
1162                    const wxString& name = wxPyCheckBoxNameStr);
 
1164     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
1165     %pragma(python) addtomethod = "wxPreToggleButton:val._setOORInfo(val)"
 
1167     void SetValue(bool value);
 
1168     bool GetValue() const ;
 
1169     void SetLabel(const wxString& label);
 
1175 //----------------------------------------------------------------------
 
1176 //----------------------------------------------------------------------
 
1177 //----------------------------------------------------------------------