File: ArtProvider.xsp

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (205 lines) | stat: -rw-r--r-- 6,042 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#############################################################################
## 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