File: Pen.xs

package info (click to toggle)
libwx-perl 0.9702-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,240 kB
  • ctags: 1,812
  • sloc: cpp: 8,988; perl: 6,366; makefile: 38; ansic: 1
file content (213 lines) | stat: -rw-r--r-- 3,978 bytes parent folder | download
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
#############################################################################
## Name:        XS/Pen.xs
## Purpose:     XS for Wx::Pen
## Author:      Mattia Barbon
## Modified by:
## Created:     21/11/2000
## RCS-ID:      $Id: Pen.xs 2340 2008-03-25 22:25:07Z mbarbon $
## Copyright:   (c) 2000-2003, 2004, 2006-2008 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

#include <wx/colour.h>
#include <wx/pen.h>

MODULE=Wx PACKAGE=Wx::Pen

void
wxPen::new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wcol_n_n, newColour )
        MATCH_REDISP( wxPliOvl_wbmp_n, newBitmap )
        MATCH_REDISP( wxPliOvl_s_n_n, newString )
    END_OVERLOAD( Wx::Pen::new )

wxPen*
newColour( CLASS, colour, width, style )
    SV* CLASS
    wxColour* colour
    int width
    int style
  CODE:
    RETVAL = new wxPen( *colour, width, style );
  OUTPUT:
    RETVAL

wxPen*
newString( CLASS, name, width, style )
    SV* CLASS
    wxString name
    int width
    int style
  CODE:
    RETVAL = new wxPen( name, width, style );
  OUTPUT:
    RETVAL

#if defined( __WXMSW__ ) || defined( __WXPERL_FORCE__ )

wxPen*
newBitmap( CLASS, stipple, width )
    SV* CLASS
    wxBitmap* stipple
    int width
  CODE:
    RETVAL = new wxPen( *stipple, width );

#endif

static void
wxPen::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );

## // thread OK
void
wxPen::DESTROY()
  CODE:
    wxPli_thread_sv_unregister( aTHX_ "Wx::Pen", THIS, ST(0) );
    delete THIS;

wxPenCap
wxPen::GetCap()

wxColour*
wxPen::GetColour()
  CODE:
    RETVAL = new wxColour( THIS->GetColour() );
  OUTPUT:
    RETVAL

void
wxPen::GetDashes()
  PREINIT:
    int i, n;
    wxDash* array;
  PPCODE:
    n = THIS->GetDashes( &array );
    EXTEND( SP, n );
    for( i = 0; i < n; ++i )
    {
      PUSHs( sv_2mortal( newSViv( array[i] ) ) );
    }

wxPenJoin
wxPen::GetJoin()

#if defined( __WXMSW__ ) || defined( __WXPERL_FORCE__ )

wxBitmap*
wxPen::GetStipple()
  CODE:
    RETVAL = new wxBitmap( *THIS->GetStipple() );
  OUTPUT:
    RETVAL

#endif

wxPenStyle
wxPen::GetStyle()

int
wxPen::GetWidth()

bool
wxPen::Ok()

#if WXPERL_W_VERSION_GE( 2, 8, 0 )

bool
wxPen::IsOk()

#endif

void
wxPen::SetCap( capStyle )
    wxPenCap capStyle

void
wxPen::SetColour( ... )
  PPCODE:
     BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wcol, SetColourColour )
        MATCH_REDISP( wxPliOvl_n_n_n, SetColourRGB )
        MATCH_REDISP( wxPliOvl_s, SetColourName )
    END_OVERLOAD( Wx::Pen::SetColour )

void
wxPen::SetColourColour( colour )
    wxColour* colour
  CODE:
    THIS->SetColour( *colour );

void
wxPen::SetColourName( name )
    wxString name
  CODE:
    THIS->SetColour( name );

void
wxPen::SetColourRGB( r, g, b )
    int r
    int g
    int b
  CODE:
    THIS->SetColour( r, g, b );

void
wxPen::SetDashes( ds )
    SV* ds
  PREINIT:
    int n = 0;
    wxDash* dashes = 0;
    wxDash* olddashes;
  CODE:
    THIS->GetDashes( &olddashes );
    if( SvOK( ds ) )
    {
      AV* av;
      SV* t;
      int i;

      if( !SvROK( ds ) || 
          ( SvTYPE( (SV*) ( av = (AV*) SvRV( ds ) ) ) != SVt_PVAV ) )
      {
          croak( "the value is not an array reference" );
          XSRETURN_UNDEF;
      }
    
      n = av_len( av ) + 1;
      dashes = new wxDash[ n ];

      for( i = 0; i < n; ++i )
      {
        t = *av_fetch( av, i, 0 );
        dashes[i] = SvIV( t );
      }
    }
    THIS->SetDashes( n, dashes );
    delete[] olddashes;

void
wxPen::SetJoin( join_style )
    wxPenJoin join_style

#if defined( __WXMSW__ ) || defined( __WXPERL_FORCE__ )

void
wxPen::SetStipple( stipple )
    wxBitmap* stipple
  CODE:
    THIS->SetStipple( *stipple );

#endif

void
wxPen::SetStyle( style )
    wxPenStyle style

void
wxPen::SetWidth( width )
    int width