File: GLCanvas.xs

package info (click to toggle)
libwx-glcanvas-perl 0.09-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: cpp: 644; perl: 311; makefile: 18
file content (255 lines) | stat: -rw-r--r-- 6,128 bytes parent folder | download | duplicates (4)
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/////////////////////////////////////////////////////////////////////////////
// Name:        GLCanvas.xs
// Purpose:     XSor Wx::GLCanvas.pm
// Author:      Mattia Barbon
// Modified by:
// Created:     26/07/2003
// RCS-ID:      $Id: GLCanvas.xs 2489 2008-10-27 19:50:51Z mbarbon $
// Copyright:   (c) 2003, 2005, 2007-2008 Mattia Barbon
// Licence:     This program is free software; you can redistribute it and/or
//              modify it under the same terms as Perl itself
/////////////////////////////////////////////////////////////////////////////

#define STRICT
#define PERL_NO_GET_CONTEXT
#define WXINTL_NO_GETTEXT_MACRO 1

#include <wx/defs.h>
#include "wx/window.h"
#include "cpp/wxapi.h"
#include "cpp/overload.h"
#include "cpp/ovl_const.h"
#include "cpp/ovl_const.cpp"

#undef THIS

#if WXPERL_W_VERSION_GE( 2, 5, 0 ) && wxUSE_GLCANVAS
    #include <wx/glcanvas.h>
#else
    #ifdef __WXMSW__
        #undef  wxUSE_GLCANVAS
        #define wxUSE_GLCANVAS 1
        #define WXDLLIMPEXP_GL

        #include "wx/myglcanvas.h"
        #include "wx/glcanvas.cpp"
    #else
        #include <wx/glcanvas.h>
    #endif
#endif

int* wxPli_get_attribute_list( pTHX_ SV* avref )
{
    if( !avref )
        return NULL;

    // special case for empty array
    if(    SvROK( avref )
        && SvTYPE( SvRV( avref ) ) == SVt_PVAV
        && av_len( (AV*) SvRV( avref ) ) == -1 )
        return NULL;

    int* array;
    wxPli_av_2_intarray( aTHX_ avref, &array );

    return array;
}

static double constant( const char *name, int arg )
{
    errno = 0;

#define r( n ) \
    if( strEQ( name, #n ) ) \
        return n;

    switch( name[0] )
    {
    case 'W':
        r( WX_GL_RGBA );
        r( WX_GL_BUFFER_SIZE );
        r( WX_GL_LEVEL );
        r( WX_GL_DOUBLEBUFFER );
        r( WX_GL_STEREO );
        r( WX_GL_AUX_BUFFERS );
        r( WX_GL_MIN_RED );
        r( WX_GL_MIN_GREEN );
        r( WX_GL_MIN_BLUE );
        r( WX_GL_MIN_ALPHA );
        r( WX_GL_DEPTH_SIZE );
        r( WX_GL_STENCIL_SIZE );
        r( WX_GL_MIN_ACCUM_RED );
        r( WX_GL_MIN_ACCUM_GREEN );
        r( WX_GL_MIN_ACCUM_BLUE );
        r( WX_GL_MIN_ACCUM_ALPHA );
        break;
    default:
        break;
    }

#undef r
    errno = EINVAL;

    return 0;
}

MODULE=Wx__GLCanvas PACKAGE=Wx::GLCanvas

BOOT:
  INIT_PLI_HELPERS( wx_pli_helpers );

double
constant( name, arg )
    const char* name
    int arg

## DECLARE_OVERLOAD( wglx, Wx::GLContext )
## DECLARE_OVERLOAD( wglc, Wx::GLCanvas )

void
wxGLCanvas::new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wwin_n_wpoi_wsiz_n_s, newDefault, 1 )
#if WXPERL_W_VERSION_LT( 2, 9, 0 )
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wwin_wglx_n_wpoi_wsiz_n_s, newContext, 2 )
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wwin_wglc_n_wpoi_wsiz_n_s, newCanvas, 2 )
#endif
    END_OVERLOAD( Wx::GLCanvas::new )

static wxGLCanvas*
wxGLCanvas::newDefault( parent, id = -1, pos = wxDefaultPosition, size = wxDefaultSize, style = 0, name = wxGLCanvasName, attributes = NULL )
    wxWindow* parent
    wxWindowID id
    wxPoint pos
    wxSize size
    long style
    wxString name
    SV_null* attributes
  CODE:
    wxPliArrayGuard<int> attrs = wxPli_get_attribute_list( aTHX_ attributes );
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = new wxGLCanvas( parent, id, attrs, pos, size, style, name );
#else
    RETVAL = new wxGLCanvas( parent, id, pos, size, style, name, attrs );
#endif
    wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
  OUTPUT: RETVAL

#if WXPERL_W_VERSION_GE( 2, 9, 0 )

void
wxGLCanvas::SetCurrent( context )
    wxGLContext* context
  C_ARGS: *context

#else

static wxGLCanvas*
wxGLCanvas::newContext( parent, context, id = -1, pos = wxDefaultPosition, size = wxDefaultSize, style = 0, name = wxGLCanvasName, attributes = NULL )
    wxWindow* parent
    wxGLContext* context
    wxWindowID id
    wxPoint pos
    wxSize size
    long style
    wxString name
    SV_null* attributes
  CODE:
    wxPliArrayGuard<int> attrs = wxPli_get_attribute_list( aTHX_ attributes );
    RETVAL = new wxGLCanvas( parent, context, id, pos, size, style, name, attrs );
    wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
  OUTPUT: RETVAL

static wxGLCanvas*
wxGLCanvas::newCanvas( parent, canvas, id = -1, pos = wxDefaultPosition, size = wxDefaultSize, style = 0, name = wxGLCanvasName, attributes = NULL )
    wxWindow* parent
    wxGLCanvas* canvas
    wxWindowID id
    wxPoint pos
    wxSize size
    long style
    wxString name
    SV_null* attributes
  CODE:
    wxPliArrayGuard<int> attrs = wxPli_get_attribute_list( aTHX_ attributes );
    RETVAL = new wxGLCanvas( parent, canvas, id, pos, size, style, name, attrs );
    wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
  OUTPUT: RETVAL

wxGLContext*
wxGLCanvas::GetContext()

void
wxGLCanvas::SetCurrent()

#endif

#ifdef __WXMSW__

void
wxGLCanvas::SetupPalette( palette )
    wxPalette* palette
  CODE:
    THIS->SetupPalette( *palette );

#endif

void
wxGLCanvas::SwapBuffers()

MODULE=Wx__GLCanvas PACKAGE=Wx::GLContext

#if    ( WXPERL_W_VERSION_GE( 2, 7, 1 ) && !defined( __WXMAC__ ) ) \
    || WXPERL_W_VERSION_GE( 2, 9, 0 )

wxGLContext*
wxGLContext::new(win, cxt = NULL )
    wxGLCanvas* win
    wxGLContext* cxt
  CODE:
    RETVAL = cxt ? new wxGLContext( win, cxt )
                 : new wxGLContext( win );
  OUTPUT: RETVAL

#else
#if !defined( __WXMAC__ )

wxGLContext*
wxGLContext::new( isRGB, win, palette = (wxPalette*)&wxNullPalette, cxt = NULL )
    bool isRGB
    wxGLCanvas* win
    wxPalette* palette
    wxGLContext* cxt
  CODE:
    RETVAL = cxt ? new wxGLContext( isRGB, win, *palette, cxt )
                 : new wxGLContext( isRGB, win, *palette );
  OUTPUT: RETVAL

#endif
#endif

#if    ( WXPERL_W_VERSION_GE( 2, 7, 1 ) && !defined( __WXMAC__ ) ) \
    || WXPERL_W_VERSION_GE( 2, 9, 0 )

void
wxGLContext::SetCurrent( wxGLCanvas* canvas )
  C_ARGS: *canvas

#else

void
wxGLContext::SetCurrent()

void
wxGLContext::SwapBuffers()

#endif

#if WXPERL_W_VERSION_LE( 2, 7, 0 )

void
wxGLContext::SetColour( colour )
    wxString colour

#endif