X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7bf854050fd5c04469d4334524433a31d4ba997a..d9f39e09e82e99c422619f4e3df536d0a9e87987:/utils/wxPython/src/controls.i?ds=sidebyside diff --git a/utils/wxPython/src/controls.i b/utils/wxPython/src/controls.i index 925459c540..605a9d697c 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,23 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +%module controls +%{ #include "helpers.h" #include #include +#include + +#ifdef __WXMSW__ +#if wxUSE_OWNER_DRAWN +#include +#endif +#endif + +#ifdef __WXGTK__ +#include +#endif %} //---------------------------------------------------------------------- @@ -30,6 +41,8 @@ %import gdi.i %import events.i +%pragma(python) code = "import wx" + //---------------------------------------------------------------------- %{ @@ -41,7 +54,7 @@ wxValidator wxPyDefaultValidator; // Non-const default because of SWIG class wxControl : public wxWindow { public: void Command(wxCommandEvent& event); - wxString& GetLabel(); + wxString GetLabel(); void SetLabel(const wxString& label); }; @@ -55,6 +68,9 @@ public: long style = 0, const wxValidator& validator = wxPyDefaultValidator, char* name = "button"); + + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + void SetDefault(); }; @@ -69,14 +85,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 +109,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 +127,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); @@ -132,6 +154,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(); @@ -170,6 +194,8 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "gauge"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + int GetBezelFace(); int GetRange(); int GetShadowWidth(); @@ -202,6 +228,8 @@ public: long style = 0, char* name = "staticText"); + %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + wxString GetLabel(); void SetLabel(const wxString& label); }; @@ -218,6 +246,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 +256,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