1 #############################################################################
3 ## Purpose: XS for Wx::Font
4 ## Author: Mattia Barbon
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 #############################################################################
13 MODULE=Wx PACKAGE=Wx::NativeFontInfo
15 #include <wx/fontutil.h>
20 wxNativeFontInfo::new()
23 wxNativeFontInfo::CLONE()
25 wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
29 wxNativeFontInfo::DESTROY()
31 wxPli_thread_sv_unregister( aTHX_ "Wx::NativeFontInfo", THIS, ST(0) );
35 wxNativeFontInfo::FromString( string )
39 wxNativeFontInfo::ToString()
42 wxNativeFontInfo::FromUserString( string )
46 wxNativeFontInfo::ToUserString()
48 MODULE=Wx PACKAGE=Wx::Font
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 )
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 )
63 newNativeInfo( CLASS, info )
67 #if defined(__WXMOTIF__) || defined(__WXX11__)
68 wxNativeFontInfo fontinfo;
69 fontinfo.FromString( info );
70 RETVAL = new wxFont( fontinfo );
72 RETVAL = new wxFont( info );
77 newFont( CLASS, font )
81 RETVAL = new wxFont( *font );
85 newLong( CLASS, pointsize, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
93 wxFontEncoding encoding
95 RETVAL = new wxFont( pointsize, family, style, weight, underline,
99 #if defined(__WXMSW__) && WXPERL_W_VERSION_GE( 2, 5, 3 )
102 newSize( CLASS, size, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
110 wxFontEncoding encoding
112 RETVAL = new wxFont( size, family, style, weight, underline, faceName, encoding );
117 ## //static contructors
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 )
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 )
132 NewPoint( CLASS, pointsize, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
140 wxFontEncoding encoding
142 RETVAL = wxFont::New( pointsize, family, style, weight, underline,
143 faceName, encoding );
147 NewPointFlags( CLASS, pointsize, family, flags = wxFONTFLAG_DEFAULT, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
153 wxFontEncoding encoding
155 RETVAL = wxFont::New( pointsize, family, flags, faceName, encoding );
158 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
161 NewSize( CLASS, size, family, style, weight, underline = false, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
169 wxFontEncoding encoding
171 RETVAL = wxFont::New( size, family, style, weight, underline, faceName, encoding );
175 NewSizeFlags( CLASS, size, family, flags = wxFONTFLAG_DEFAULT, faceName = wxEmptyString, encoding = wxFONTENCODING_DEFAULT )
181 wxFontEncoding encoding
183 RETVAL = wxFont::New( size, family, flags, faceName, encoding );
191 wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
197 wxPli_thread_sv_unregister( aTHX_ "Wx::Font", THIS, ST(0) );
201 font_spaceship( fnt1, fnt2, ... )
205 // this is not a proper spaceship method
206 // it just allows autogeneration of != and ==
207 // anyway, comparing fontss is just useless
209 if( SvROK( fnt1 ) && SvROK( fnt2 ) &&
210 sv_derived_from( fnt1, "Wx::Font" ) &&
211 sv_derived_from( fnt2, "Wx::Font" ) )
213 wxFont* font1 = (wxFont*)wxPli_sv_2_object( aTHX_ fnt1, "Wx::Font" );
214 wxFont* font2 = (wxFont*)wxPli_sv_2_object( aTHX_ fnt2, "Wx::Font" );
216 RETVAL = *font1 == *font2 ? 0 : 1;
226 RETVAL = wxFont::GetDefaultEncoding();
231 wxFont::GetFaceName()
236 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
239 wxFont::GetNativeFontInfo()
241 RETVAL = new wxNativeFontInfo( *(THIS->GetNativeFontInfo()) );
247 wxFont::GetNativeFontInfo()
252 wxFont::SetNativeFontInfoUserDesc( info )
256 wxFont::GetFamilyString()
259 wxFont::GetStyleString()
262 wxFont::GetWeightString()
265 wxFont::GetNativeFontInfoDesc()
268 wxFont::GetNativeFontInfoUserDesc()
270 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
273 wxFont::GetPixelSize()
275 RETVAL = new wxSize( THIS->GetPixelSize() );
282 wxFont::GetEncoding()
285 wxFont::GetPointSize()
291 wxFont::GetUnderlined()
297 wxFont::IsFixedWidth()
302 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
310 SetDefaultEncoding( encoding )
311 wxFontEncoding encoding
313 wxFont::SetDefaultEncoding( encoding );
315 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
318 wxFont::SetFaceName( faceName )
324 wxFont::SetFaceName( faceName )
330 wxFont::SetEncoding( encoding )
331 wxFontEncoding encoding
334 wxFont::SetFamily( family )
338 wxFont::SetNativeFontInfo( info )
341 THIS->SetNativeFontInfo( info );
343 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
346 wxFont::SetPixelSize( pixelsize )
350 wxFont::IsUsingSizeInPixels()
355 wxFont::SetPointSize( pointsize )
359 wxFont::SetStyle( style )
363 wxFont::SetUnderlined( underlined )
367 wxFont::SetWeight( weight )