Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / ArtProvider.xsp
1 #############################################################################
2 ## Name:        XS/ArtProvider.xsp
3 ## Purpose:     XS++ for wxArtProvider class
4 ## Author:      Matthew "Cheetah" Gabeler-Lee
5 ## Modified by:
6 ## Created:     10/01/2005
7 ## RCS-ID:      $Id: ArtProvider.xsp 2499 2008-11-05 19:47:18Z mbarbon $
8 ## Copyright:   (c) 2005-2008 Matthew Gabeler-Lee
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 %module{Wx};
14
15 %typemap{wxPlArtProvider*}{simple};
16
17 %file{cpp/artprov.h};
18
19 %{
20
21 #include "cpp/v_cback.h"
22
23 #define DEC_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( METHOD ) \
24   wxBitmap METHOD( const wxArtID& id, const wxArtClient& client, const wxSize& size )
25
26 #define DEF_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( CLASS, BASE, METHOD ) \
27   wxBitmap CLASS::METHOD( const wxArtID& id, const wxArtClient& client,      \
28                           const wxSize& size )                               \
29   {                                                                          \
30       dTHX;                                                                  \
31       if( wxPliVirtualCallback_FindCallback( aTHX_ &m_callback, #METHOD ) )  \
32       {                                                                      \
33           wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback,                \
34                         G_SCALAR, "PPo", &id, &client, new wxSize( size ) ) );\
35           return *(wxBitmap*)wxPli_sv_2_object( aTHX_ ret, "Wx::Bitmap" );   \
36       } else                                                                 \
37           return wxNullBitmap;                                               \
38   }
39
40 #define DEC_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( METHOD ) \
41   wxIconBundle METHOD( const wxArtID& id, const wxArtClient& client )
42
43 #define DEF_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( CLASS, BASE, METHOD ) \
44   wxIconBundle CLASS::METHOD( const wxArtID& id, const wxArtClient& client )     \
45   {                                                                          \
46       dTHX;                                                                  \
47       if( wxPliVirtualCallback_FindCallback( aTHX_ &m_callback, #METHOD ) )  \
48       {                                                                      \
49           wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback,                \
50                         G_SCALAR, "PP", &id, &client ) );                    \
51           return *(wxIconBundle*)wxPli_sv_2_object( aTHX_ ret, "Wx::IconBundle" );   \
52       } else                                                                 \
53           return wxNullIconBundle;                                           \
54   }
55
56 class wxPlArtProvider : public wxArtProvider
57 {
58     WXPLI_DECLARE_DYNAMIC_CLASS( wxPlArtProvider );
59     WXPLI_DECLARE_V_CBACK();
60 public:
61     wxPlArtProvider( const char* package )
62       : m_callback( "Wx::ArtProvider" )
63     {
64         m_callback.SetSelf( wxPli_make_object( this, package ), true );
65     }
66
67     DEC_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( CreateBitmap );
68 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
69     DEC_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( CreateIconBundle );
70 #endif
71 };
72
73 DEF_V_CBACK_WXBITMAP__WXARTID_WXARTCLIENT_WXSIZE_pure( wxPlArtProvider,
74   wxArtProvider, CreateBitmap );
75 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
76 DEF_V_CBACK_WXICONBUNDLE__WXARTID_WXARTCLIENT_pure( wxPlArtProvider,
77   wxArtProvider, CreateIconBundle );
78 #endif
79
80 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
81 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlArtProvider, wxArtProvider );
82 #else
83 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlArtProvider, wxObject );
84 #endif
85
86 %}
87
88 %file{-};
89
90 %{
91
92 #if WXPERL_W_VERSION_GE( 2, 5, 2 )
93
94 #include <wx/artprov.h>
95 #include "cpp/artprov.h"
96
97 MODULE=Wx PACKAGE=Wx::ArtProvider
98
99 #!sub CreateBitmap
100 #!sub CreateIconBundle
101
102 wxBitmap*
103 GetBitmap( id, client = wxART_OTHER, size = wxDefaultSize )
104     wxString id
105     wxString client
106     wxSize size
107   CODE:
108     RETVAL = new wxBitmap( wxArtProvider::GetBitmap( id, client, size ) );
109   OUTPUT: RETVAL
110
111 wxIcon*
112 GetIcon( id, client = wxART_OTHER, size = wxDefaultSize )
113     wxString id
114     wxString client
115     wxSize size
116   CODE:
117     RETVAL = new wxIcon( wxArtProvider::GetIcon( id, client, size ) );
118   OUTPUT: RETVAL
119
120 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
121
122 wxIconBundle*
123 GetIconBundle( id, client = wxART_OTHER )
124     wxString id
125     wxString client
126   CODE:
127     RETVAL = new wxIconBundle( wxArtProvider::GetIconBundle( id, client ) );
128   OUTPUT: RETVAL
129
130 #endif
131
132 bool
133 PopProvider()
134   CODE:
135 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
136     RETVAL = wxArtProvider::Pop();
137 #else
138     RETVAL = wxArtProvider::PopProvider();
139 #endif
140   OUTPUT: RETVAL
141
142 void
143 PushProvider( provider )
144     wxArtProvider* provider
145   CODE:
146 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
147     wxArtProvider::Push( provider);
148 #else
149     wxArtProvider::PushProvider( provider);
150 #endif
151
152 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
153
154 void
155 InsertProvider( provider )
156     wxArtProvider* provider
157   CODE:
158 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
159     wxArtProvider::PushBack( provider);
160 #else
161     wxArtProvider::Insert( provider);
162 #endif
163
164 #endif
165
166 bool
167 RemoveProvider( provider )
168     wxArtProvider* provider
169   CODE:
170 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
171     RETVAL = wxArtProvider::Remove( provider );
172 #else
173     RETVAL = wxArtProvider::RemoveProvider( provider );
174 #endif
175   OUTPUT: RETVAL
176
177 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
178
179 bool
180 DeleteProvider( provider )
181     wxArtProvider* provider
182   CODE:
183     RETVAL = wxArtProvider::Delete( provider );
184   OUTPUT: RETVAL
185
186 #endif
187
188 MODULE=Wx PACKAGE=Wx::PlArtProvider
189
190 wxPlArtProvider*
191 wxPlArtProvider::new()
192   CODE:
193     RETVAL = new wxPlArtProvider( CLASS );
194   OUTPUT: RETVAL
195
196 %}
197
198 %name{Wx::PlArtProvider} class wxPlArtProvider
199 {
200   wxBitmap CreateBitmap( const wxArtID& id, const wxArtClient& client,
201     const wxSize& size );
202 };
203
204 #endif