X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0bfbd2c743a4f78f6368909dc301c30cec41872..f62262aacfac8b03ad7b8aca946c4fd5717b6c2e:/wxPython/src/_artprov.i diff --git a/wxPython/src/_artprov.i b/wxPython/src/_artprov.i index 6a214f5363..0e7a2a44e4 100644 --- a/wxPython/src/_artprov.i +++ b/wxPython/src/_artprov.i @@ -31,6 +31,7 @@ MAKE_CONST_WXSTRING(ART_CMN_DIALOG); MAKE_CONST_WXSTRING(ART_HELP_BROWSER); MAKE_CONST_WXSTRING(ART_MESSAGE_BOX); MAKE_CONST_WXSTRING(ART_BUTTON); +MAKE_CONST_WXSTRING(ART_LIST); MAKE_CONST_WXSTRING(ART_OTHER); // Art IDs @@ -115,6 +116,30 @@ public: return rval; } + virtual wxIconBundle CreateIconBundle(const wxArtID& id, + const wxArtClient& client) + { + wxIconBundle rval = wxNullIconBundle; + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + if ((wxPyCBH_findCallback(m_myInst, "CreateIconBundle"))) { + PyObject* ro; + wxIconBundle* ptr; + PyObject* s1, *s2; + s1 = wx2PyString(id); + s2 = wx2PyString(client); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", s1, s2)); + Py_DECREF(s1); + Py_DECREF(s2); + if (ro) { + if (wxPyConvertSwigPtr(ro, (void**)&ptr, wxT("wxIconBundle"))) + rval = *ptr; + Py_DECREF(ro); + } + } + wxPyEndBlockThreads(blocked); + return rval; + } + PYPRIVATE; }; %} @@ -131,7 +156,7 @@ asks wx.ArtProvider for it instead. This way the users can plug in their own wx.ArtProvider class and easily replace standard art with his/her own version. It is easy thing to do: all that is needed is to derive a class from wx.ArtProvider, override it's CreateBitmap -method and register the provider with wx.ArtProvider.PushProvider:: +method and register the provider with `wx.ArtProvider.Push`:: class MyArtProvider(wx.ArtProvider): def __init__(self): @@ -148,7 +173,7 @@ Identifying art resources Every bitmap is known to wx.ArtProvider under an unique ID that is used when requesting a resource from it. The IDs can have one of the following predefined values. Additionally, any string recognized by -custom art providers registered using `PushProvider` may be used. +custom art providers registered using `Push` may be used. GTK+ Note --------- @@ -237,39 +262,46 @@ identical bitmap for different client values! MustHaveApp(wxPyArtProvider); MustHaveApp(wxPyArtProvider::GetBitmap); MustHaveApp(wxPyArtProvider::GetIcon); +MustHaveApp(wxPyArtProvider::GetBundle); %rename(ArtProvider) wxPyArtProvider; class wxPyArtProvider /*: public wxObject*/ { public: - %pythonAppend wxPyArtProvider "self._setCallbackInfo(self, ArtProvider)" + %pythonAppend wxPyArtProvider setCallbackInfo(ArtProvider); wxPyArtProvider(); ~wxPyArtProvider(); void _setCallbackInfo(PyObject* self, PyObject* _class); %disownarg( wxPyArtProvider *provider ); + DocDeclStr( - static void , PushProvider(wxPyArtProvider *provider), + static void , Push(wxPyArtProvider *provider), "Add new provider to the top of providers stack.", ""); - + %pythoncode { PushProvider = Push } + DocDeclStr( - static void , InsertProvider(wxPyArtProvider *provider), + static void , Insert(wxPyArtProvider *provider), "Add new provider to the bottom of providers stack.", ""); + %pythoncode { InsertProvider = Insert } + %cleardisown( wxPyArtProvider *provider ); DocDeclStr( - static bool , PopProvider(), + static bool , Pop(), "Remove latest added provider and delete it.", ""); + %pythoncode { PopProvider = Pop } - %pythonAppend RemoveProvider "args[1].thisown = 1"; + %pythonAppend Delete "args[1].thisown = 1"; DocDeclStr( - static bool , RemoveProvider(wxPyArtProvider *provider), + static bool , Delete(wxPyArtProvider *provider), "Remove provider. The provider must have been added previously! The provider is _not_ deleted.", ""); - + %pythoncode { RemoveProvider = Delete } + DocDeclStr( static wxBitmap , GetBitmap(const wxString& id, @@ -281,11 +313,18 @@ wx.NullBitmap if no provider provides it.", ""); DocDeclStr( static wxIcon , GetIcon(const wxString& id, - const wxString& client = wxPyART_OTHER, + const wxString& client = wxPyART_OTHER, const wxSize& size = wxDefaultSize), "Query the providers for icon with given ID and return it. Return wx.NullIcon if no provider provides it.", ""); + DocDeclStr( + static wxIconBundle , GetIconBundle(const wxArtID& id, + const wxArtClient& client = wxART_OTHER), + "Query the providers for iconbundle with given ID and return it. Return +wx.NullIconBundle if no provider provides it.", ""); + + DocDeclStr( static wxSize , GetSizeHint(const wxString& client, bool platform_dependent = false), "Get the size hint of an icon from a specific Art Client, queries the @@ -293,7 +332,7 @@ topmost provider if platform_dependent = false", ""); - %pythonAppend Destroy "args[0].thisown = 0" + %pythonPrepend Destroy "args[0].this.own(False)" %extend { void Destroy() { delete self; }} };