1 #############################################################################
2 ## Name: ext/richtext/XS/RichTextBuffer.xsp
3 ## Purpose: XS++ for Wx::RichTextBuffer
4 ## Author: Mattia Barbon
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 #############################################################################
14 #include <wx/richtext/richtextbuffer.h>
18 ## DECLARE_OVERLOAD( wrta, Wx::RichTextAttr )
19 ## DECLARE_OVERLOAD( wrtr, Wx::RichTextRange )
20 ## DECLARE_OVERLOAD( wtae, Wx::TextAttrEx )
22 %name{Wx::RichTextBuffer} class wxRichTextBuffer
24 bool AddEventHandler( wxEvtHandler* handler );
25 void AddHandler( wxRichTextFileHandler* handler );
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 );
36 wxRichTextBuffer::SetStyle( ... )
39 MATCH_REDISP( wxPliOvl_wrtr_wrta_n, SetStyleRange )
40 MATCH_REDISP( wxPliOvl_wrtr_wtae_n, SetStyleExRange )
41 END_OVERLOAD( "Wx::RichTextBuffer::SetStyle" )
46 bool InsertTextWithUndo( long pos, const wxString& text,
47 wxRichTextCtrl* ctrl, int flags = 0 );
48 bool InsertNewlineWithUndo( long pos, wxRichTextCtrl* ctrl,
51 const wxTextAttrEx& GetBasicStyle() const;
52 const wxTextAttrEx& GetDefaultStyle() const;
54 bool BeginStyle( const wxTextAttrEx& style );
61 bool BeginUnderline();
63 bool BeginFontSize( int pointSize );
65 bool BeginFont( const wxFont& font );
67 bool BeginTextColour( const wxColour& colour );
69 bool BeginAlignment( wxTextAttrAlignment alignment );
71 bool BeginLeftIndent( int leftIndent, int leftSubIndent = 0 );
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,
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 );
87 bool BeginSymbolBullet( wxChar symbol, int leftIndent,
88 int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
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();
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,
104 bool BeginURL( const wxString& url,
105 const wxString& characterStyle = wxEmptyString );
108 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
109 bool ClearListStyle( const wxRichTextRange& range,
110 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
113 wxRichTextRange AddParagraph( const wxString& text );
114 wxRichTextRange AddImage( const wxImage& image );
116 bool BeginBatchUndo( const wxString& cmdName );
118 bool BatchingUndo() const;
119 bool BeginSuppressUndo();
120 bool EndSuppressUndo();
121 bool SuppressingUndo() const;
123 void SetStyleSheet( wxRichTextStyleSheet* styleSheet );
124 wxRichTextStyleSheetDisown* GetStyleSheet() const;
126 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
127 bool PushStyleSheet( wxRichTextStyleSheetDisown* styleSheet );
128 wxRichTextStyleSheetDisown* PopStyleSheet();
131 %name{SetBasicStyleRich} void SetBasicStyle( const wxRichTextAttr& style );
132 %name{SetBasicStyleEx} void SetBasicStyle( const wxTextAttrEx& style );
135 wxRichTextBuffer::SetBasicStyle( ... )
138 MATCH_REDISP( wxPliOvl_wrta, SetBasicStyleRich )
139 MATCH_REDISP( wxPliOvl_wtae, SetBasicStyleEx )
140 END_OVERLOAD( "Wx::RichTextBuffer::SetBasicStyle" )
148 wxRichTextCtrl::GetRichTextAttrStyle( position )
152 bool retval = THIS->GetStyle( position, attr );
154 PUSHs( newSViv( retval ) );
155 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
156 new wxRichTextAttr( attr ),
157 "Wx::RichTextAttr" ) :
161 wxRichTextCtrl::GetTextAttrExStyle( position )
165 bool retval = THIS->GetStyle( position, attr );
167 PUSHs( newSViv( retval ) );
168 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
169 new wxTextAttrEx( attr ),
173 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
176 wxRichTextCtrl::GetRichTextAttrUncombinedStyle( position )
180 bool retval = THIS->GetUncombinedStyle( position, attr );
182 PUSHs( newSViv( retval ) );
183 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
184 new wxRichTextAttr( attr ),
185 "Wx::RichTextAttr" ) :
189 wxRichTextCtrl::GetTextAttrExUncombinedStyle( position )
193 bool retval = THIS->GetUncombinedStyle( position, attr );
195 PUSHs( newSViv( retval ) );
196 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
197 new wxTextAttrEx( attr ),
203 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
206 wxRichTextCtrl::GetRichTextAttrStyleForRange( range )
207 wxRichTextRange* range
210 bool retval = THIS->GetStyleForRange( *range, attr );
212 PUSHs( newSViv( retval ) );
213 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
214 new wxRichTextAttr( attr ),
215 "Wx::RichTextAttr" ) :
219 wxRichTextCtrl::GetTextAttrExStyleForRange( range )
220 wxRichTextRange* range
223 bool retval = THIS->GetStyleForRange( *range, attr );
225 PUSHs( newSViv( retval ) );
226 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
227 new wxTextAttrEx( attr ),