Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / richtext / XS / RichTextAttr.xsp
1 #############################################################################
2 ## Name:        ext/richtext/XS/RichTextAttr.xsp
3 ## Purpose:     XS++ for Wx::RichTextAttr and Wx::TextAttrEx
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     05/11/2006
7 ## RCS-ID:      $Id: RichTextAttr.xsp 2568 2009-05-17 15:52:56Z mbarbon $
8 ## Copyright:   (c) 2006-2009 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 #include <wx/event.h>
14 #include <wx/richtext/richtextbuffer.h>
15
16 %module{Wx};
17
18 %name{Wx::RichTextRange} class wxRichTextRange
19 {
20     %name{newDefault} wxRichTextRange();
21     %name{newFromTo} wxRichTextRange( long start, long end );
22     %name{newCopy} wxRichTextRange( const wxRichTextRange& range );
23
24 %{
25 static void
26 wxRichTextRange::CLONE()
27   CODE:
28     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
29 %}
30     ## // thread OK
31     ~wxRichTextRange()
32         %code{% wxPli_thread_sv_unregister( aTHX_ "Wx::RichTextRange", THIS, ST(0) );
33                 delete THIS;
34                 %};
35
36     void SetRange( long start, long end );
37     void SetStart( long start );
38     long GetStart() const;
39
40     void SetEnd( long end );
41     long GetEnd() const;
42
43     bool IsOutside( const wxRichTextRange& range ) const;
44     bool IsWithin( const wxRichTextRange& range ) const;
45
46     bool Contains( long pos ) const;
47     bool LimitTo( const wxRichTextRange& range );
48     long GetLength() const;
49 };
50
51 ## DECLARE_OVERLOAD( wrtr, Wx::RichTextRange )
52
53 %{
54
55 void
56 wxRichTextRange::new( ... )
57   PPCODE:
58     BEGIN_OVERLOAD()
59         MATCH_VOIDM_REDISP( newDefault )
60         MATCH_REDISP( wxPliOvl_n_n, newFromTo )
61         MATCH_REDISP( wxPliOvl_wrtr, newCopy )
62     END_OVERLOAD( Wx::RichTextRange::new )
63
64 %}
65
66 %name{Wx::TextAttrEx} class wxTextAttrEx
67 {
68     %name{newDefault} wxTextAttrEx();
69     %name{newCopy} wxTextAttrEx( const wxTextAttrEx& attr );
70     %name{newAttr} wxTextAttrEx( const wxTextAttr& attr );
71
72 %{
73 static void
74 wxTextAttrEx::CLONE()
75   CODE:
76     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
77 %}
78     ## // thread OK
79     ~wxTextAttrEx()
80         %code{% wxPli_thread_sv_unregister( aTHX_ "Wx::TextAttrEx", THIS, ST(0) );
81                 delete THIS;
82                 %};
83
84     void SetCharacterStyleName( const wxString& name );
85     void SetParagraphStyleName( const wxString& name );
86 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
87     void SetListStyleName( const wxString& name );
88 #endif
89     void SetParagraphSpacingAfter( int spacing );
90     void SetParagraphSpacingBefore( int spacing );
91     void SetLineSpacing( int spacing );
92     void SetBulletStyle( int style );
93     void SetBulletNumber( int n );
94 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
95     void SetBulletText( const wxString& text );
96     void SetBulletName( const wxString& name );
97     void SetBulletFont( const wxString& bulletFont );
98     void SetURL( const wxString& url );
99     void SetPageBreak( bool pageBreak = true );
100 #endif
101
102     const wxString& GetCharacterStyleName() const;
103     const wxString& GetParagraphStyleName() const;
104 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
105     const wxString& GetListStyleName() const;
106 #endif
107     int GetParagraphSpacingAfter() const;
108     int GetParagraphSpacingBefore() const;
109     int GetLineSpacing() const;
110     int GetBulletStyle() const;
111     int GetBulletNumber() const;
112 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
113     const wxString& GetBulletText() const;
114     const wxString& GetBulletName() const;
115     const wxString& GetBulletFont() const;
116     const wxString& GetURL() const;
117 #endif
118
119 #if WXPERL_W_VERSION_LT( 2, 8, 0 )
120     bool HasWeight() const;
121     bool HasSize() const;
122     bool HasItalic() const;
123     bool HasUnderlined() const;
124     bool HasFaceName() const;
125 #endif
126
127     bool HasParagraphSpacingAfter() const;
128     bool HasParagraphSpacingBefore() const;
129     bool HasLineSpacing() const;
130     bool HasCharacterStyleName() const;
131     bool HasParagraphStyleName() const;
132 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
133     bool HasListStyleName() const;
134 #endif
135     bool HasBulletStyle() const;
136     bool HasBulletNumber() const;
137 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
138     bool HasBulletText() const;
139     bool HasBulletName() const;
140     bool HasURL() const;
141     bool HasPageBreak() const;
142 #endif
143
144     bool IsCharacterStyle() const;
145     bool IsParagraphStyle() const;
146
147     bool IsDefault() const;
148
149 #if WXPERL_W_VERSION_LT( 2, 9, 0 ) && WXPERL_W_VERSION_GE( 2, 8, 0 )
150     int GetOutlineLevel() const;
151     bool HasOutlineLevel() const;
152     void SetOutlineLevel( int level );
153
154     int GetTextEffects() const;
155     bool HasTextEffects() const;
156     void SetTextEffects( int effects );
157
158     int GetTextEffectFlags() const;
159     bool HasTextEffect( int effect ) const;
160     void SetTextEffectFlags( int effects );
161 #endif
162 };
163
164 ## DECLARE_OVERLOAD( wtae, Wx::TextAttrEx )
165 ## DECLARE_OVERLOAD( wtat, Wx::TextAttr )
166
167 %{
168
169 void
170 wxTextAttrEx::new( ... )
171   PPCODE:
172     BEGIN_OVERLOAD()
173         MATCH_VOIDM_REDISP( newDefault )
174         MATCH_REDISP( wxPliOvl_wtae, newCopy )
175         MATCH_REDISP( wxPliOvl_wtat, newAttr )
176     END_OVERLOAD( Wx::TextAttrEx::new )
177
178 %}
179
180 %name{Wx::RichTextAttr} class wxRichTextAttr
181 {
182     %name{newDefault} wxRichTextAttr();
183     %name{newCopy} wxRichTextAttr( const wxRichTextAttr& attr );
184     %name{newAttrEx} wxRichTextAttr( const wxTextAttrEx& attr );
185     %name{newAttr} wxRichTextAttr( const wxTextAttr& attr );
186 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
187     %name{newFull} wxRichTextAttr
188         ( const wxColour& colText, const wxColour& colBack = wxNullColourPtr,
189           const wxFont& font = wxNullFontPtr,
190           wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT );
191 #else
192     %name{newFull} wxRichTextAttr
193         ( const wxColour& colText, const wxColour& colBack = wxNullColourPtr,
194           wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT );
195 #endif
196 %{
197 static void
198 wxRichTextAttr::CLONE()
199   CODE:
200     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
201 %}
202     ## // thread OK
203     ~wxRichTextAttr()
204         %code{% wxPli_thread_sv_unregister( aTHX_ "Wx::RichTextAttr", THIS, ST(0) );
205                 delete THIS;
206                 %};
207
208 #if WXPERL_W_VERSION_LT( 2, 9, 0 )
209     wxFont CreateFont() const;
210 #endif
211     bool GetFontAttributes( const wxFont& font );
212
213     void SetTextColour( const wxColour& colText );
214     void SetBackgroundColour( const wxColour& colBack );
215     void SetAlignment( wxTextAttrAlignment alignment );
216     void SetTabs( const wxArrayInt& tabs );
217     void SetLeftIndent( int indent, int subIndent = 0 );
218     void SetRightIndent( int indent );
219
220     void SetFontSize( int pointSize );
221     void SetFontStyle( wxFontStyle fontStyle );
222     void SetFontWeight( wxFontWeight fontWeight );
223     void SetFontFaceName( const wxString& faceName );
224     void SetFontUnderlined( bool underlined );
225
226     void SetFlags( long flags );
227
228     void SetCharacterStyleName( const wxString& name );
229     void SetParagraphStyleName( const wxString& name );
230 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
231     void SetListStyleName( const wxString& name );
232 #endif
233     void SetParagraphSpacingAfter( int spacing );
234     void SetParagraphSpacingBefore( int spacing );
235     void SetLineSpacing( int spacing );
236     void SetBulletStyle( int style );
237     void SetBulletNumber( int n );
238 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
239     void SetBulletText( const wxString& text );
240     void SetBulletFont( const wxString& bulletFont );
241     void SetBulletName( const wxString& name );
242     void SetURL( const wxString& url );
243     void SetPageBreak( bool pageBreak = true );
244 #endif
245
246     const wxColour& GetTextColour() const;
247     const wxColour& GetBackgroundColour() const;
248     wxTextAttrAlignment GetAlignment() const;
249     long GetLeftIndent() const;
250     long GetLeftSubIndent() const;
251     long GetRightIndent() const;
252     long GetFlags() const;
253
254     int GetFontSize() const;
255 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
256     wxFontStyle GetFontStyle() const;
257     wxFontWeight GetFontWeight() const;
258 #else
259     int GetFontStyle() const;
260     int GetFontWeight() const;
261 #endif
262     bool GetFontUnderlined() const;
263     const wxString& GetFontFaceName() const;
264
265     const wxString& GetCharacterStyleName() const;
266     const wxString& GetParagraphStyleName() const;
267 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
268     const wxString& GetListStyleName() const;
269 #endif
270     int GetParagraphSpacingAfter() const;
271     int GetParagraphSpacingBefore() const;
272     int GetLineSpacing() const;
273     int GetBulletStyle() const;
274     int GetBulletNumber() const;
275 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
276     const wxString& GetBulletText() const;
277     const wxString& GetBulletFont() const;
278     const wxString& GetBulletName() const;
279     const wxString& GetURL() const;
280 #endif
281
282     bool HasTextColour() const;
283     bool HasBackgroundColour() const;
284     bool HasAlignment() const;
285     bool HasTabs() const;
286     bool HasLeftIndent() const;
287     bool HasRightIndent() const;
288 #if WXPERL_W_VERSION_LT( 2, 8, 0 )
289     bool HasWeight() const;
290     bool HasSize() const;
291     bool HasItalic() const;
292     bool HasUnderlined() const;
293     bool HasFaceName() const;
294 #endif
295     bool HasFont() const;
296
297     bool HasParagraphSpacingAfter() const;
298     bool HasParagraphSpacingBefore() const;
299     bool HasLineSpacing() const;
300     bool HasCharacterStyleName() const;
301     bool HasParagraphStyleName() const;
302 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
303     bool HasListStyleName() const;
304 #endif
305     bool HasBulletStyle() const;
306     bool HasBulletNumber() const;
307 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
308     bool HasBulletText() const;
309     bool HasBulletName() const;
310     bool HasURL() const;
311     bool HasPageBreak() const;
312 #endif
313
314     bool IsCharacterStyle() const;
315     bool IsParagraphStyle() const;
316
317     bool IsDefault() const;
318 };
319
320 ## DECLARE_OVERLOAD( wrta, Wx::RichTextAttr )
321
322 %{
323
324 void
325 wxRichTextAttr::new( ... )
326   PPCODE:
327     BEGIN_OVERLOAD()
328         MATCH_VOIDM_REDISP( newDefault )
329         MATCH_REDISP( wxPliOvl_wrta, newCopy )
330         MATCH_REDISP( wxPliOvl_wtae, newAttrEx )
331         MATCH_REDISP( wxPliOvl_wtat, newAttr )
332         MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wcol_wcol_n, newFull, 2 )
333     END_OVERLOAD( Wx::RichTextAttr::new )
334
335 void
336 wxRichTextAttr::GetTabs()
337   PPCODE:
338     const wxArrayInt& tabs = THIS->GetTabs();
339     PUTBACK;
340     wxPli_intarray_push( aTHX_ tabs );
341     SPAGAIN;
342
343 %}