Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / richtext / XS / RichTextBuffer.xsp
1 #############################################################################
2 ## Name:        ext/richtext/XS/RichTextBuffer.xsp
3 ## Purpose:     XS++ for Wx::RichTextBuffer
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     03/09/2007
7 ## RCS-ID:      $Id: RichTextBuffer.xsp 2738 2010-01-03 20:03:42Z mbarbon $
8 ## Copyright:   (c) 2007, 2010 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 ## DECLARE_OVERLOAD( wrta, Wx::RichTextAttr )
19 ## DECLARE_OVERLOAD( wrtr, Wx::RichTextRange )
20 ## DECLARE_OVERLOAD( wtae, Wx::TextAttrEx )
21
22 %name{Wx::RichTextBuffer} class wxRichTextBuffer
23 {
24     bool AddEventHandler( wxEvtHandler* handler );
25     void AddHandler( wxRichTextFileHandler* handler );
26
27 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
28     %name{SetStyleRange} bool SetStyle
29         ( const wxRichTextRange& range, const wxTextAttrEx& style,
30           int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
31     %name{SetStyleExRange} bool SetStyle
32         ( const wxRichTextRange& range, const wxRichTextAttr& style,
33           int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
34 %{
35 void
36 wxRichTextBuffer::SetStyle( ... )
37   PPCODE:
38     BEGIN_OVERLOAD()
39         MATCH_REDISP( wxPliOvl_wrtr_wrta_n, SetStyleRange )
40         MATCH_REDISP( wxPliOvl_wrtr_wtae_n, SetStyleExRange )
41     END_OVERLOAD( "Wx::RichTextBuffer::SetStyle" )
42
43 %}
44 #endif
45
46     bool InsertTextWithUndo( long pos, const wxString& text,
47                              wxRichTextCtrl* ctrl, int flags = 0 );
48     bool InsertNewlineWithUndo( long pos, wxRichTextCtrl* ctrl,
49                                 int flags = 0 );
50
51     const wxTextAttrEx& GetBasicStyle() const;
52     const wxTextAttrEx& GetDefaultStyle() const;
53
54     bool BeginStyle( const wxTextAttrEx& style );
55     bool EndStyle();
56     bool EndAllStyles();
57     bool BeginBold();
58     bool EndBold();
59     bool BeginItalic();
60     bool EndItalic();
61     bool BeginUnderline();
62     bool EndUnderline();
63     bool BeginFontSize( int pointSize );
64     bool EndFontSize();
65     bool BeginFont( const wxFont& font );
66     bool EndFont();
67     bool BeginTextColour( const wxColour& colour );
68     bool EndTextColour();
69     bool BeginAlignment( wxTextAttrAlignment alignment );
70     bool EndAlignment();
71     bool BeginLeftIndent( int leftIndent, int leftSubIndent = 0 );
72     bool EndLeftIndent();
73     bool BeginRightIndent( int rightIndent );
74     bool EndRightIndent();
75     bool BeginParagraphSpacing( int before, int after );
76     bool EndParagraphSpacing();
77     bool BeginLineSpacing( int lineSpacing );
78     bool EndLineSpacing();
79     bool BeginNumberedBullet( int bulletNumber, int leftIndent, 
80                               int leftSubIndent,
81                               int bulletStyle = wxTEXT_ATTR_DEFAULT_NUMBERED_BULLET );
82     bool EndNumberedBullet();
83 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
84     bool BeginSymbolBullet( const wxString& symbol, int leftIndent,
85                             int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
86 #else
87     bool BeginSymbolBullet( wxChar symbol, int leftIndent,
88                             int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
89 #endif
90     bool EndSymbolBullet();
91 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
92     bool BeginStandardBullet( const wxString& bulletName, int leftIndent,
93                               int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD );
94     bool EndStandardBullet();
95 #endif
96     bool BeginCharacterStyle( const wxString& characterStyle );
97     bool EndCharacterStyle();
98     bool BeginParagraphStyle( const wxString& paragraphStyle );
99     bool EndParagraphStyle();
100 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
101     bool BeginListStyle( const wxString& listStyle, int level = 1,
102                          int number = 1 );
103     bool EndListStyle();
104     bool BeginURL( const wxString& url,
105                    const wxString& characterStyle = wxEmptyString );
106     bool EndURL();
107 #endif
108 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
109     bool ClearListStyle( const wxRichTextRange& range,
110                          int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
111 #endif
112
113     wxRichTextRange AddParagraph( const wxString& text );
114     wxRichTextRange AddImage( const wxImage& image );
115
116     bool BeginBatchUndo( const wxString& cmdName );
117     bool EndBatchUndo();
118     bool BatchingUndo() const;
119     bool BeginSuppressUndo();
120     bool EndSuppressUndo();
121     bool SuppressingUndo() const;
122
123     void SetStyleSheet( wxRichTextStyleSheet* styleSheet );
124     wxRichTextStyleSheetDisown* GetStyleSheet() const;
125
126 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
127     bool PushStyleSheet( wxRichTextStyleSheetDisown* styleSheet );
128     wxRichTextStyleSheetDisown* PopStyleSheet();
129 #endif
130
131     %name{SetBasicStyleRich} void SetBasicStyle( const wxRichTextAttr& style );
132     %name{SetBasicStyleEx} void SetBasicStyle( const wxTextAttrEx& style );
133 %{
134 void
135 wxRichTextBuffer::SetBasicStyle( ... )
136   PPCODE:
137     BEGIN_OVERLOAD()
138         MATCH_REDISP( wxPliOvl_wrta, SetBasicStyleRich )
139         MATCH_REDISP( wxPliOvl_wtae, SetBasicStyleEx )
140     END_OVERLOAD( "Wx::RichTextBuffer::SetBasicStyle" )
141
142 %}
143
144 };
145
146 %{
147 void
148 wxRichTextCtrl::GetRichTextAttrStyle( position )
149     long position
150   PPCODE:
151     wxRichTextAttr attr;
152     bool retval = THIS->GetStyle( position, attr );
153     EXTEND( SP, 2 );
154     PUSHs( newSViv( retval ) );
155     PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
156                                            new wxRichTextAttr( attr ),
157                                            "Wx::RichTextAttr" ) :
158                     &PL_sv_undef );
159
160 void
161 wxRichTextCtrl::GetTextAttrExStyle( position )
162     long position
163   PPCODE:
164     wxTextAttrEx attr;
165     bool retval = THIS->GetStyle( position, attr );
166     EXTEND( SP, 2 );
167     PUSHs( newSViv( retval ) );
168     PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
169                                            new wxTextAttrEx( attr ),
170                                            "Wx::TextAttrEx" ) :
171                     &PL_sv_undef );
172
173 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
174
175 void
176 wxRichTextCtrl::GetRichTextAttrUncombinedStyle( position )
177     long position
178   PPCODE:
179     wxRichTextAttr attr;
180     bool retval = THIS->GetUncombinedStyle( position, attr );
181     EXTEND( SP, 2 );
182     PUSHs( newSViv( retval ) );
183     PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
184                                            new wxRichTextAttr( attr ),
185                                            "Wx::RichTextAttr" ) :
186                     &PL_sv_undef );
187
188 void
189 wxRichTextCtrl::GetTextAttrExUncombinedStyle( position )
190     long position
191   PPCODE:
192     wxTextAttrEx attr;
193     bool retval = THIS->GetUncombinedStyle( position, attr );
194     EXTEND( SP, 2 );
195     PUSHs( newSViv( retval ) );
196     PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
197                                            new wxTextAttrEx( attr ),
198                                            "Wx::TextAttrEx" ) :
199                     &PL_sv_undef );
200
201 #endif
202
203 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
204
205 void
206 wxRichTextCtrl::GetRichTextAttrStyleForRange( range )
207     wxRichTextRange* range
208   PPCODE:
209     wxRichTextAttr attr;
210     bool retval = THIS->GetStyleForRange( *range, attr );
211     EXTEND( SP, 2 );
212     PUSHs( newSViv( retval ) );
213     PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
214                                            new wxRichTextAttr( attr ),
215                                            "Wx::RichTextAttr" ) :
216                     &PL_sv_undef );
217
218 void
219 wxRichTextCtrl::GetTextAttrExStyleForRange( range )
220     wxRichTextRange* range
221   PPCODE:
222     wxTextAttrEx attr;
223     bool retval = THIS->GetStyleForRange( *range, attr );
224     EXTEND( SP, 2 );
225     PUSHs( newSViv( retval ) );
226     PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
227                                            new wxTextAttrEx( attr ),
228                                            "Wx::TextAttrEx" ) :
229                     &PL_sv_undef );
230
231 #endif
232
233 %}