Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Font.xs
1 #############################################################################
2 ## Name:        XS/Font.xs
3 ## Purpose:     XS for Wx::Font
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     29/10/2000
7 ## RCS-ID:      $Id: Font.xs 2050 2007-05-13 18:38:33Z mbarbon $
8 ## Copyright:   (c) 2000-2004, 2006-2007 Mattia Barbon
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 PACKAGE=Wx::NativeFontInfo
14
15 #include <wx/fontutil.h>
16
17 #undef THIS
18
19 wxNativeFontInfo*
20 wxNativeFontInfo::new()
21
22 static void
23 wxNativeFontInfo::CLONE()
24   CODE:
25     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
26
27 ## // thread OK
28 void
29 wxNativeFontInfo::DESTROY()
30   CODE:
31     wxPli_thread_sv_unregister( aTHX_ "Wx::NativeFontInfo", THIS, ST(0) );
32     delete THIS;
33
34 bool
35 wxNativeFontInfo::FromString( string )
36     wxString string
37
38 wxString
39 wxNativeFontInfo::ToString()
40
41 bool
42 wxNativeFontInfo::FromUserString( string )
43     wxString string
44
45 wxString
46 wxNativeFontInfo::ToUserString()
47
48 MODULE=Wx PACKAGE=Wx::Font
49
50 void
51 wxFont::new( ... )
52   PPCODE:
53     BEGIN_OVERLOAD()
54         MATCH_REDISP( wxPliOvl_wfon, newFont )
55 #if defined(__WXMSW__) && WXPERL_W_VERSION_GE( 2, 5, 3 )     
56         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wsiz_n_n_n_b_s_n, newSize, 4 )
57 #endif
58         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_n_n_n_b_s_n, newLong, 4 )
59         MATCH_REDISP( wxPliOvl_s, newNativeInfo )
60     END_OVERLOAD( Wx::Font::new )
61
62 wxFont*
63 newNativeInfo( CLASS, info )
64     SV* CLASS
65     wxString info
66   CODE:
67 #if defined(__WXMOTIF__) || defined(__WXX11__)
68     wxNativeFontInfo fontinfo;
69     fontinfo.FromString( info );
70     RETVAL = new wxFont( fontinfo );
71 #else
72     RETVAL = new wxFont( info );
73 #endif
74   OUTPUT: RETVAL
75
76 wxFont*
77 newFont( CLASS, font )
78     SV* CLASS
79     wxFont* font
80   CODE:
81     RETVAL = new wxFont( *font );
82   OUTPUT: RETVAL
83
84 wxFont*
85 newLong( CLASS, pointsize, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
86     SV* CLASS
87     int pointsize
88     int family
89     int style
90     int weight
91     bool underline
92     wxString faceName
93     wxFontEncoding encoding
94   CODE:
95     RETVAL = new wxFont( pointsize, family, style, weight, underline,
96                          faceName, encoding );
97   OUTPUT: RETVAL
98   
99 #if defined(__WXMSW__) && WXPERL_W_VERSION_GE( 2, 5, 3 )     
100
101 wxFont*
102 newSize( CLASS, size, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
103     SV* CLASS
104     wxSize size
105     int family
106     int style
107     int weight
108     bool underline
109     wxString faceName
110     wxFontEncoding encoding
111   CODE:
112     RETVAL = new wxFont( size, family, style, weight, underline, faceName, encoding );
113   OUTPUT: RETVAL
114   
115 #endif
116
117 ## //static contructors
118
119 void
120 New( ... )
121   PPCODE:
122     BEGIN_OVERLOAD()
123 #if WXPERL_W_VERSION_GE( 2, 5, 3 )    
124         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wsiz_n_n_n_b_s_n, NewSize, 4 )
125         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wsiz_n_n_s_n, NewSizeFlags, 2 )
126 #endif
127         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_n_n_n_b_s_n, NewPoint, 4 )
128         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_n_n_s_n, NewPointFlags, 2 )
129     END_OVERLOAD( Wx::Font::New )
130
131 wxFont*
132 NewPoint( CLASS, pointsize, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
133     SV* CLASS
134     int pointsize
135     wxFontFamily family
136     int style
137     int weight
138     bool underline
139     wxString faceName
140     wxFontEncoding encoding
141   CODE:
142     RETVAL = wxFont::New( pointsize, family, style, weight, underline,
143                            faceName, encoding );
144   OUTPUT: RETVAL
145   
146 wxFont*
147 NewPointFlags( CLASS, pointsize, family, flags = wxFONTFLAG_DEFAULT, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
148     SV* CLASS
149     int pointsize
150     wxFontFamily family
151     int flags
152     wxString faceName
153     wxFontEncoding encoding
154   CODE:
155     RETVAL = wxFont::New( pointsize, family, flags, faceName, encoding );
156   OUTPUT: RETVAL  
157
158 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
159
160 wxFont*
161 NewSize( CLASS, size, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
162     SV* CLASS
163     wxSize size
164     wxFontFamily family
165     int style
166     int weight
167     bool underline
168     wxString faceName
169     wxFontEncoding encoding
170   CODE:
171     RETVAL = wxFont::New( size, family, style, weight, underline, faceName, encoding );
172   OUTPUT: RETVAL
173   
174 wxFont*
175 NewSizeFlags( CLASS, size, family, flags = wxFONTFLAG_DEFAULT, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
176     SV* CLASS
177     wxSize size
178     wxFontFamily family
179     int flags
180     wxString faceName
181     wxFontEncoding encoding
182   CODE:
183     RETVAL = wxFont::New( size, family, flags, faceName, encoding );
184   OUTPUT: RETVAL  
185
186 #endif
187
188 static void
189 wxFont::CLONE()
190   CODE:
191     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
192
193 ## // thread OK
194 void
195 wxFont::DESTROY()
196   CODE:
197     wxPli_thread_sv_unregister( aTHX_ "Wx::Font", THIS, ST(0) );
198     delete THIS;
199
200 int
201 font_spaceship( fnt1, fnt2, ... )
202     SV* fnt1
203     SV* fnt2
204   CODE:
205     // this is not a proper spaceship method
206     // it just allows autogeneration of != and ==
207     // anyway, comparing fontss is just useless
208     RETVAL = -1;
209     if( SvROK( fnt1 ) && SvROK( fnt2 ) &&
210         sv_derived_from( fnt1, "Wx::Font" ) &&
211         sv_derived_from( fnt2, "Wx::Font" ) )
212     {
213         wxFont* font1 = (wxFont*)wxPli_sv_2_object( aTHX_ fnt1, "Wx::Font" );
214         wxFont* font2 = (wxFont*)wxPli_sv_2_object( aTHX_ fnt2, "Wx::Font" );
215
216         RETVAL = *font1 == *font2 ? 0 : 1;
217     }
218     else
219       RETVAL = 1;
220   OUTPUT:
221     RETVAL
222
223 wxFontEncoding
224 GetDefaultEncoding()
225   CODE:
226     RETVAL = wxFont::GetDefaultEncoding();
227   OUTPUT:
228     RETVAL
229
230 wxString
231 wxFont::GetFaceName()
232
233 int
234 wxFont::GetFamily()
235
236 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
237
238 wxNativeFontInfo*
239 wxFont::GetNativeFontInfo()
240   CODE:
241     RETVAL = new wxNativeFontInfo( *(THIS->GetNativeFontInfo()) );
242   OUTPUT: RETVAL
243
244 #else
245
246 wxNativeFontInfo*
247 wxFont::GetNativeFontInfo()
248
249 #endif
250
251 void
252 wxFont::SetNativeFontInfoUserDesc( info )
253     wxString info
254
255 wxString
256 wxFont::GetFamilyString()
257     
258 wxString
259 wxFont::GetStyleString()
260
261 wxString
262 wxFont::GetWeightString()
263
264 wxString
265 wxFont::GetNativeFontInfoDesc()
266
267 wxString
268 wxFont::GetNativeFontInfoUserDesc()
269
270 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
271
272 wxSize*
273 wxFont::GetPixelSize()
274   CODE:
275     RETVAL = new wxSize( THIS->GetPixelSize() );
276   OUTPUT:
277     RETVAL
278     
279 #endif    
280     
281 wxFontEncoding
282 wxFont::GetEncoding()
283
284 int
285 wxFont::GetPointSize()
286
287 int
288 wxFont::GetStyle()
289
290 bool
291 wxFont::GetUnderlined()
292
293 int
294 wxFont::GetWeight()
295
296 bool
297 wxFont::IsFixedWidth()
298
299 bool
300 wxFont::Ok()
301
302 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
303
304 bool
305 wxFont::IsOk()
306
307 #endif
308
309 void
310 SetDefaultEncoding( encoding )
311     wxFontEncoding encoding
312   CODE:
313     wxFont::SetDefaultEncoding( encoding );
314
315 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
316
317 bool
318 wxFont::SetFaceName( faceName )
319     wxString faceName
320
321 #else
322
323 void
324 wxFont::SetFaceName( faceName )
325     wxString faceName
326
327 #endif
328
329 void
330 wxFont::SetEncoding( encoding )
331     wxFontEncoding encoding
332
333 void
334 wxFont::SetFamily( family )
335     int family
336
337 void
338 wxFont::SetNativeFontInfo( info )
339     wxString info
340   CODE:
341     THIS->SetNativeFontInfo( info );
342
343 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
344
345 void
346 wxFont::SetPixelSize( pixelsize )
347     wxSize pixelsize
348     
349 bool
350 wxFont::IsUsingSizeInPixels()    
351     
352 #endif    
353
354 void
355 wxFont::SetPointSize( pointsize )
356     int pointsize
357
358 void
359 wxFont::SetStyle( style )
360     int style
361
362 void
363 wxFont::SetUnderlined( underlined )
364     bool underlined
365
366 void
367 wxFont::SetWeight( weight )
368     int weight