Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / richtext / XS / RichTextStyle.xsp
1 #############################################################################
2 ## Name:        ext/richtext/XS/RichTextStyle.xsp
3 ## Purpose:     XS++ for Wx::RichText*Style*
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     12/11/2006
7 ## RCS-ID:      $Id: RichTextStyle.xsp 2568 2009-05-17 15:52:56Z mbarbon $
8 ## Copyright:   (c) 2006, 2008-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/richtext/richtextstyles.h>
14
15 %module{Wx};
16
17 %name{Wx::RichTextStyleDefinition} class wxRichTextStyleDefinition
18 {
19 %{
20 static void
21 wxRichTextStyleDefinition::CLONE()
22   CODE:
23     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
24 %}
25     ## // thread OK
26     ~wxRichTextStyleDefinition()
27         %code%{  wxPli_thread_sv_unregister( aTHX_ wxPli_get_class( aTHX_ ST(0) ), THIS, ST(0) );
28                  if( wxPli_object_is_deleteable( aTHX_ ST(0) ) )
29                      delete THIS;
30                %};
31
32 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
33     void Copy( const wxRichTextStyleDefinition& def );
34     bool Eq( const wxRichTextStyleDefinition& def ) const;
35 #endif
36     void SetName( const wxString& name );
37     const wxString& GetName() const;
38 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
39     void SetDescription( const wxString& descr );
40     const wxString& GetDescription() const;
41 #endif
42     void SetBaseStyle( const wxString& name );
43     const wxString& GetBaseStyle() const;
44     void SetStyle( const wxRichTextAttr& style );
45     const wxRichTextAttr& GetStyle() const;
46 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
47     const wxTextAttr& GetStyleMergedWithBase( wxRichTextStyleSheet* sheet ) const;
48 #endif
49 };
50
51 %name{Wx::RichTextCharacterStyleDefinition} class wxRichTextCharacterStyleDefinition
52 {
53     wxRichTextCharacterStyleDefinition( const wxString& name = wxEmptyString );
54 };
55
56 %name{Wx::RichTextParagraphStyleDefinition} class wxRichTextParagraphStyleDefinition
57 {
58     wxRichTextParagraphStyleDefinition( const wxString& name = wxEmptyString );
59
60 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
61     void Copy( const wxRichTextParagraphStyleDefinition& def );
62 #endif
63
64     void SetNextStyle( const wxString& name );
65     const wxString& GetNextStyle() const;
66 };
67
68 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
69
70 %name{Wx::RichTextListStyleDefinition} class wxRichTextListStyleDefinition
71 {
72     wxRichTextListStyleDefinition( const wxString& name = wxEmptyString );
73
74     void Copy( const wxRichTextListStyleDefinition& def );
75
76     void SetLevelAttributes( int i, const wxRichTextAttr& attr );
77     wxRichTextAttrDisown* GetLevelAttributes( int i ) const;
78
79     void SetAttributes( int i, int leftIndent, int leftSubIndent,
80                         int bulletStyle,
81                         const wxString& bulletSymbol = wxEmptyString );
82     int FindLevelForIndent( int indent ) const;
83     wxRichTextAttr& CombineWithParagraphStyle
84         ( int indent, const wxRichTextAttr& paraStyle );
85     wxRichTextAttr& GetCombinedStyle( int indent );
86     wxRichTextAttr& GetCombinedStyleForLevel( int level );
87     int GetLevelCount() const;
88     bool IsNumbered( int i ) const;
89 };
90
91 #endif
92
93 %name{Wx::RichTextStyleSheet} class wxRichTextStyleSheet
94 {
95     wxRichTextStyleSheet();
96
97 %{
98 static void
99 wxRichTextStyleSheet::CLONE()
100   CODE:
101     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
102 %}
103     ## // thread OK
104     ~wxRichTextStyleSheet()
105         %code%{  wxPli_thread_sv_unregister( aTHX_ "Wx::RichTextStyleSheet", THIS, ST(0) );
106                  if( wxPli_object_is_deleteable( aTHX_ ST(0) ) )
107                      delete THIS;
108                %};
109
110 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
111     bool AddStyle( wxRichTextStyleDefinitionDisown* def );
112     wxRichTextStyleDefinitionDisown* FindStyle( const wxString& name ) const;
113     bool RemoveStyle( wxRichTextStyleDefinition* def,
114                       bool deleteStyle = false );
115 #endif
116
117 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
118     void Copy( const wxRichTextStyleSheet& sheet );
119 #endif
120
121     bool AddCharacterStyle( wxRichTextCharacterStyleDefinitionDisown* def );
122     bool AddParagraphStyle( wxRichTextParagraphStyleDefinitionDisown* def );
123 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
124     bool AddListStyle( wxRichTextListStyleDefinitionDisown* def );
125 #endif
126
127     bool RemoveCharacterStyle( wxRichTextStyleDefinition* def,
128                                bool deleteStyle = false );
129     bool RemoveParagraphStyle( wxRichTextStyleDefinition* def,
130                                bool deleteStyle = false );
131 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
132     bool RemoveListStyle( wxRichTextStyleDefinition* def,
133                           bool deleteStyle = false );
134 #endif
135
136 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
137     wxRichTextCharacterStyleDefinitionDisown* FindCharacterStyle
138         ( const wxString& name, bool recurse = true ) const;
139     wxRichTextParagraphStyleDefinitionDisown* FindParagraphStyle
140         ( const wxString& name, bool recurse = true ) const;
141     wxRichTextListStyleDefinitionDisown* FindListStyle( const wxString& name,
142                                                   bool recurse = true) const;
143 #endif
144
145     size_t GetCharacterStyleCount() const;
146     size_t GetParagraphStyleCount() const;
147 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
148     size_t GetListStyleCount() const;
149 #endif
150
151     wxRichTextCharacterStyleDefinitionDisown* GetCharacterStyle( size_t n ) const;
152     wxRichTextParagraphStyleDefinitionDisown* GetParagraphStyle( size_t n ) const;
153 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
154     wxRichTextListStyleDefinitionDisown* GetListStyle( size_t n ) const;
155 #endif
156
157     void DeleteStyles();
158 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
159     bool InsertSheet( wxRichTextStyleSheet* before );
160     bool AppendSheet( wxRichTextStyleSheet* after );
161
162     void Unlink();
163     wxRichTextStyleSheetDisown* GetNextSheet() const;
164     void SetNextSheet( wxRichTextStyleSheet* sheet );
165
166     wxRichTextStyleSheetDisown* GetPreviousSheet() const;
167     void SetPreviousSheet( wxRichTextStyleSheet* sheet );
168 #endif
169 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
170     void SetName( const wxString& name );
171     const wxString& GetName() const;
172     void SetDescription( const wxString& descr );
173     const wxString& GetDescription() const;
174 #endif
175 };