############################################################################# ## Name: XS/ArtProvider.xsp ## Purpose: XS++ for wxArtProvider class ## Author: Matthew "Cheetah" Gabeler-Lee ## Modified by: ## Created: 10/01/2005 ## RCS-ID: $Id: ArtProvider.xsp 2927 2010-06-06 08:06:10Z mbarbon $ ## Copyright: (c) 2005-2008, 2010 Matthew Gabeler-Lee ## Licence: This program is free software; you can redistribute it and/or ## modify it under the same terms as Perl itself ############################################################################# %module{Wx}; %typemap{wxPlArtProvider*}{simple}; %file{xspp/artprov.h}; %{ #include "cpp/v_cback.h" #define DEC_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( METHOD ) \ wxBitmap METHOD( const wxArtID& id, const wxArtClient& client, const wxSize& size ) #define DEF_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( CLASS, BASE, METHOD ) \ wxBitmap CLASS::METHOD( const wxArtID& id, const wxArtClient& client, \ const wxSize& size ) \ { \ dTHX; \ if( wxPliVirtualCallback_FindCallback( aTHX_ &m_callback, #METHOD ) ) \ { \ wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback, \ G_SCALAR, "PPo", &id, &client, \ new wxSize( size ), "Wx::Size" ) ); \ return *(wxBitmap*)wxPli_sv_2_object( aTHX_ ret, "Wx::Bitmap" ); \ } else \ return wxNullBitmap; \ } #define DEC_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( METHOD ) \ wxIconBundle METHOD( const wxArtID& id, const wxArtClient& client ) #define DEF_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( CLASS, BASE, METHOD ) \ wxIconBundle CLASS::METHOD( const wxArtID& id, const wxArtClient& client ) \ { \ dTHX; \ if( wxPliVirtualCallback_FindCallback( aTHX_ &m_callback, #METHOD ) ) \ { \ wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback, \ G_SCALAR, "PP", &id, &client ) ); \ return *(wxIconBundle*)wxPli_sv_2_object( aTHX_ ret, "Wx::IconBundle" ); \ } else \ return wxNullIconBundle; \ } class wxPlArtProvider : public wxArtProvider { WXPLI_DECLARE_DYNAMIC_CLASS( wxPlArtProvider ); WXPLI_DECLARE_V_CBACK(); public: wxPlArtProvider( const char* package ) : m_callback( "Wx::ArtProvider" ) { m_callback.SetSelf( wxPli_make_object( this, package ), true ); } DEC_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( CreateBitmap ); #if WXPERL_W_VERSION_GE( 2, 9, 0 ) DEC_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( CreateIconBundle ); #endif }; DEF_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( wxPlArtProvider, wxArtProvider, CreateBitmap ); #if WXPERL_W_VERSION_GE( 2, 9, 0 ) DEF_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( wxPlArtProvider, wxArtProvider, CreateIconBundle ); #endif #if WXPERL_W_VERSION_GE( 2, 5, 1 ) WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlArtProvider, wxArtProvider ); #else WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlArtProvider, wxObject ); #endif %} %file{-}; %{ #if WXPERL_W_VERSION_GE( 2, 5, 2 ) #include <wx/artprov.h> #include "xspp/artprov.h" MODULE=Wx PACKAGE=Wx::ArtProvider #!sub CreateBitmap #!sub CreateIconBundle wxBitmap* GetBitmap( id, client = wxART_OTHER, size = wxDefaultSize ) wxString id wxString client wxSize size CODE: RETVAL = new wxBitmap( wxArtProvider::GetBitmap( id, client, size ) ); OUTPUT: RETVAL wxIcon* GetIcon( id, client = wxART_OTHER, size = wxDefaultSize ) wxString id wxString client wxSize size CODE: RETVAL = new wxIcon( wxArtProvider::GetIcon( id, client, size ) ); OUTPUT: RETVAL #if WXPERL_W_VERSION_GE( 2, 9, 0 ) wxIconBundle* GetIconBundle( id, client = wxART_OTHER ) wxString id wxString client CODE: RETVAL = new wxIconBundle( wxArtProvider::GetIconBundle( id, client ) ); OUTPUT: RETVAL #endif bool PopProvider() CODE: #if WXPERL_W_VERSION_GE( 2, 7, 1 ) RETVAL = wxArtProvider::Pop(); #else RETVAL = wxArtProvider::PopProvider(); #endif OUTPUT: RETVAL void PushProvider( provider ) wxArtProvider* provider CODE: #if WXPERL_W_VERSION_GE( 2, 7, 1 ) wxArtProvider::Push( provider); #else wxArtProvider::PushProvider( provider); #endif #if WXPERL_W_VERSION_GE( 2, 7, 1 ) void InsertProvider( provider ) wxArtProvider* provider CODE: #if WXPERL_W_VERSION_GE( 2, 9, 0 ) wxArtProvider::PushBack( provider); #else wxArtProvider::Insert( provider); #endif #endif bool RemoveProvider( provider ) wxArtProvider* provider CODE: #if WXPERL_W_VERSION_GE( 2, 7, 1 ) RETVAL = wxArtProvider::Remove( provider ); #else RETVAL = wxArtProvider::RemoveProvider( provider ); #endif OUTPUT: RETVAL #if WXPERL_W_VERSION_GE( 2, 7, 2 ) bool DeleteProvider( provider ) wxArtProvider* provider CODE: RETVAL = wxArtProvider::Delete( provider ); OUTPUT: RETVAL #endif MODULE=Wx PACKAGE=Wx::PlArtProvider wxPlArtProvider* wxPlArtProvider::new() CODE: RETVAL = new wxPlArtProvider( CLASS ); OUTPUT: RETVAL %} %name{Wx::PlArtProvider} class wxPlArtProvider { wxBitmap CreateBitmap( const wxArtID& id, const wxArtClient& client, const wxSize& size ); }; #endif