X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7bf854050fd5c04469d4334524433a31d4ba997a..18ba9da6b94a34129b6b04494033905a213a0114:/utils/wxPython/src/controls.i?ds=sidebyside diff --git a/utils/wxPython/src/controls.i b/utils/wxPython/src/controls.i index 925459c540..5e92ebe7ad 100644 --- a/utils/wxPython/src/controls.i +++ b/utils/wxPython/src/controls.i @@ -1,5 +1,3 @@ -%module controls -%{ ///////////////////////////////////////////////////////////////////////////// // Name: controls.i // Purpose: Control (widget) classes for wxPython @@ -12,10 +10,25 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +%module controls +%{ #include "helpers.h" #include #include +#include +#include + +#ifdef __WXMSW__ +#if wxUSE_OWNER_DRAWN +#include +#endif +#endif + +#ifdef __WXGTK__ +#include +#endif + %} //---------------------------------------------------------------------- @@ -30,6 +43,8 @@ %import gdi.i %import events.i +%pragma(python) code = "import wx" + //---------------------------------------------------------------------- %{ @@ -40,8 +55,10 @@ wxValidator wxPyDefaultValidator; // Non-const default because of SWIG class wxControl : public wxWindow { public: +#ifdef __WXMSW__ void Command(wxCommandEvent& event); - wxString& GetLabel(); +#endif + wxString GetLabel(); void SetLabel(const wxString& label); }; @@ -55,6 +72,9 @@ public: long style = 0, const wxValidator& validator = wxPyDefaultValidator, char* name = "button"); + + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + void SetDefault(); }; @@ -69,14 +89,16 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "button"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + + wxBitmap& GetBitmapLabel(); wxBitmap& GetBitmapDisabled(); wxBitmap& GetBitmapFocus(); - wxBitmap& GetBitmapLabel(); wxBitmap& GetBitmapSelected(); void SetBitmapDisabled(const wxBitmap& bitmap); void SetBitmapFocus(const wxBitmap& bitmap); - void SetBitmapLabel(const wxBitmap& bitmap); void SetBitmapSelected(const wxBitmap& bitmap); + void SetBitmapLabel(const wxBitmap& bitmap); }; @@ -91,6 +113,8 @@ public: const wxValidator& val = wxPyDefaultValidator, char* name = "checkBox"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + bool GetValue(); void SetValue(const bool state); }; @@ -107,6 +131,8 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "choice"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + void Append(const wxString& item); void Clear(); int FindString(const wxString& string); @@ -122,7 +148,7 @@ public: //---------------------------------------------------------------------- -class wxComboBox : public wxControl { +class wxComboBox : public wxChoice { public: wxComboBox(wxWindow* parent, wxWindowID id, char* value = "", const wxPoint& pos = wxPyDefaultPosition, @@ -132,6 +158,8 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "comboBox"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + void Append(const wxString& item); // TODO: void Append(const wxString& item, char* clientData); void Clear(); @@ -154,7 +182,7 @@ public: // TODO: void SetClientData(const int n, char* data); void SetInsertionPoint(long pos); void SetInsertionPointEnd(); - void SetSelection(int n, bool select = TRUE); + void SetSelection(int n); %name(SetMark)void SetSelection(long from, long to); void SetValue(const wxString& text); }; @@ -170,6 +198,8 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "gauge"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + int GetBezelFace(); int GetRange(); int GetShadowWidth(); @@ -192,6 +222,19 @@ public: }; +//---------------------------------------------------------------------- + + +class wxStaticLine : public wxControl { +public: + wxStaticLine( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxPyDefaultPosition, + const wxSize &size = wxPyDefaultSize, + long style = wxLI_HORIZONTAL, + const char* name = "staticLine" ); +}; + + //---------------------------------------------------------------------- class wxStaticText : public wxControl { @@ -202,6 +245,8 @@ public: long style = 0, char* name = "staticText"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + wxString GetLabel(); void SetLabel(const wxString& label); }; @@ -218,6 +263,8 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "listBox"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + void Append(const wxString& item); // TODO: void Append(const wxString& item, char* clientData); void Clear(); @@ -226,7 +273,20 @@ public: int FindString(const wxString& string); // TODO: char* GetClientData(const int n); int GetSelection(); - // TODO: int GetSelections(int **selections); + + // int GetSelections(int **selections); + %addmethods { + PyObject* GetSelections() { + wxArrayInt lst; + self->GetSelections(lst); + PyObject *tup = PyTuple_New(lst.GetCount()); + for(int i=0; i