File: RichTextCtrl.xsp

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (760 lines) | stat: -rw-r--r-- 26,788 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
#############################################################################
## Name:        ext/richtext/XS/RichTextCtrl.xsp
## Purpose:     XS++ for Wx::RichTextCtrl
## Author:      Mattia Barbon
## Modified by:
## Created:     05/11/2006
## RCS-ID:      $Id: RichTextCtrl.xsp 3293 2012-05-16 20:02:24Z mdootson $
## Copyright:   (c) 2006-2008, 2010 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

#undef _
#define _(x) wxGetTranslation(wxT(x))

#include <wx/event.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/richtext/richtextctrl.h>
#include <wx/richtext/richtextstyles.h>
#include <wx/richtext/richtextformatdlg.h>
#include <wx/richtext/richtextstyledlg.h>
#include <wx/richtext/richtextprint.h>
#include "xspp/richtextctrl.h"

%module{Wx};

## DECLARE_OVERLOAD( wrtr, Wx::RichTextRange )
## DECLARE_OVERLOAD( wrta, Wx::RichTextAttr )
## DECLARE_OVERLOAD( wtae, Wx::TextAttrEx )
## DECLARE_OVERLOAD( wtat, Wx::TextAttr )

%file{xspp/richtextctrl.h};
%{

#define wxTEXT_ATTR_DEFAULT_NUMBERED_BULLET wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD

#define wxRICHTEXT_STYLE_ALL wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL
#define wxRICHTEXT_STYLE_CHARACTER wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER
#define wxRICHTEXT_STYLE_LIST wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST
#define wxRICHTEXT_STYLE_PARAGRAPH wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH

double richtextctrl_constant( const char* name, int arg )
{
    // !package: Wx
    // !parser: sub { $_[0] =~ m<^\s*r\w*\(\s*(\w+)\s*\);\s*(?://(.*))?$> }
    // !tag: richtextctrl
#define r( n ) \
    if( strEQ( name, #n ) ) \
        return n;

    WX_PL_CONSTANT_INIT();

    switch( fl )
    {
    case 'R':
        r( wxRE_READONLY );
        r( wxRE_MULTILINE );
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
        r( wxRICHTEXT_SETSTYLE_NONE );
        r( wxRICHTEXT_SETSTYLE_WITH_UNDO );
        r( wxRICHTEXT_SETSTYLE_OPTIMIZE );
        r( wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY );
        r( wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY );
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
        r( wxRICHTEXT_SETSTYLE_RENUMBER );
        r( wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL );
#endif
#if WXPERL_W_VERSION_GE( 2, 8, 7 )
        r( wxRICHTEXT_SETSTYLE_REMOVE );
#endif
        r( wxRICHTEXT_INSERT_NONE );
        r( wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE );
#endif
#if WXPERL_W_VERSION_GE( 2, 8, 0 )
        r( wxRICHTEXT_SETSTYLE_RESET );
#endif
        r( wxRICHTEXT_FIXED_WIDTH );
        r( wxRICHTEXT_FIXED_HEIGHT );
        r( wxRICHTEXT_VARIABLE_WIDTH );
        r( wxRICHTEXT_VARIABLE_HEIGHT );
        r( wxRICHTEXT_LAYOUT_SPECIFIED_RECT );
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
        r( wxRICHTEXT_DRAW_IGNORE_CACHE );
#endif
        r( wxRICHTEXT_HITTEST_NONE );
        r( wxRICHTEXT_HITTEST_BEFORE );
        r( wxRICHTEXT_HITTEST_AFTER );
        r( wxRICHTEXT_HITTEST_ON );
#if WXPERL_W_VERSION_GE( 2, 8, 7 )
        r( wxRICHTEXT_HITTEST_OUTSIDE );
#endif
        r( wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET );
        r( wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY );
        r( wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES );
        r( wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 );
#if WXPERL_W_VERSION_GE( 2, 8, 0 )
        r( wxRICHTEXT_HANDLER_NO_HEADER_FOOTER );
#endif
#if WXPERL_W_VERSION_GE( 2, 8, 8 )
        r( wxRICHTEXT_HANDLER_CONVERT_FACENAMES );
#endif

        r( wxRICHTEXT_FORMATTED );
        r( wxRICHTEXT_UNFORMATTED );
        r( wxRICHTEXT_TYPE_ANY );
        r( wxRICHTEXT_TYPE_TEXT );
        r( wxRICHTEXT_TYPE_XML );
        r( wxRICHTEXT_TYPE_HTML );
        r( wxRICHTEXT_TYPE_RTF );
        r( wxRICHTEXT_TYPE_PDF );
        r( wxRICHTEXT_FORMAT_STYLE_EDITOR );
        r( wxRICHTEXT_FORMAT_FONT );
        r( wxRICHTEXT_FORMAT_TABS );
        r( wxRICHTEXT_FORMAT_BULLETS );
        r( wxRICHTEXT_FORMAT_INDENTS_SPACING );
        r( wxRICHTEXT_FORMAT_CHARACTER );
        r( wxRICHTEXT_FORMAT_HELP_BUTTON );
        r( wxRICHTEXT_FORMAT_LIST_STYLE );
        r( wxRICHTEXT_FORMAT_PARAGRAPH );
        r( wxRICHTEXT_FORMAT_STYLE );

        r( wxRICHTEXT_ORGANISER_DELETE_STYLES );
        r( wxRICHTEXT_ORGANISER_CREATE_STYLES );
        r( wxRICHTEXT_ORGANISER_APPLY_STYLES );
        r( wxRICHTEXT_ORGANISER_EDIT_STYLES );
        r( wxRICHTEXT_ORGANISER_RENAME_STYLES );
        r( wxRICHTEXT_ORGANISER_OK_CANCEL );
        r( wxRICHTEXT_ORGANISER_RENUMBER );
        r( wxRICHTEXT_ORGANISER_SHOW_CHARACTER );
        r( wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH );
        r( wxRICHTEXT_ORGANISER_SHOW_LIST );
        r( wxRICHTEXT_ORGANISER_SHOW_ALL );
        r( wxRICHTEXT_ORGANISER_ORGANISE );
        r( wxRICHTEXT_ORGANISER_BROWSE );
        r( wxRICHTEXT_ORGANISER_BROWSE_NUMBERING );

        r( wxRICHTEXT_PAGE_ALL );
        r( wxRICHTEXT_PAGE_CENTRE );
        r( wxRICHTEXT_PAGE_EVEN );
        r( wxRICHTEXT_PAGE_LEFT );
        r( wxRICHTEXT_PAGE_ODD );
        r( wxRICHTEXT_PAGE_RIGHT );

        r( wxRICHTEXT_STYLE_ALL );
        r( wxRICHTEXT_STYLE_CHARACTER );
        r( wxRICHTEXT_STYLE_LIST );
        r( wxRICHTEXT_STYLE_PARAGRAPH );
        break;
    case 'T':
        r( wxTEXT_ATTR_PARA_SPACING_AFTER );
        r( wxTEXT_ATTR_PARA_SPACING_BEFORE );
        r( wxTEXT_ATTR_LINE_SPACING );
        r( wxTEXT_ATTR_CHARACTER_STYLE_NAME );
        r( wxTEXT_ATTR_PARAGRAPH_STYLE_NAME );
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
        r( wxTEXT_ATTR_LIST_STYLE_NAME );
#endif
        r( wxTEXT_ATTR_BULLET_STYLE );
        r( wxTEXT_ATTR_BULLET_NUMBER );
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
        r( wxTEXT_ATTR_BULLET_TEXT );
        r( wxTEXT_ATTR_BULLET_NAME );
        r( wxTEXT_ATTR_URL );
        r( wxTEXT_ATTR_PAGE_BREAK );
#endif
        r( wxTEXT_ATTR_BULLET_STYLE_NONE );
        r( wxTEXT_ATTR_BULLET_STYLE_ARABIC );
        r( wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER );
        r( wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER );
        r( wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER );
        r( wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER );
        r( wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
        r( wxTEXT_ATTR_BULLET_STYLE_BITMAP );
        r( wxTEXT_ATTR_BULLET_STYLE_PARENTHESES );
        r( wxTEXT_ATTR_BULLET_STYLE_PERIOD );
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
        r( wxTEXT_ATTR_BULLET_STYLE_STANDARD );
        r( wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS );
        r( wxTEXT_ATTR_BULLET_STYLE_OUTLINE );
        r( wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT );
        r( wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT );
        r( wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE );
#endif
        r( wxTEXT_ATTR_LINE_SPACING_NORMAL );
        r( wxTEXT_ATTR_LINE_SPACING_HALF );
        r( wxTEXT_ATTR_LINE_SPACING_TWICE );
        r( wxTEXT_ATTR_CHARACTER );
        r( wxTEXT_ATTR_PARAGRAPH );
        r( wxTEXT_ATTR_ALL );

#if WXPERL_W_VERSION_GE( 2, 8, 0 )
        r( wxTEXT_ATTR_EFFECT_NONE );
        r( wxTEXT_ATTR_EFFECT_CAPITALS );
        r( wxTEXT_ATTR_EFFECT_SMALL_CAPITALS );
        r( wxTEXT_ATTR_EFFECT_STRIKETHROUGH );
        r( wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH );
        r( wxTEXT_ATTR_EFFECT_SHADOW );
        r( wxTEXT_ATTR_EFFECT_EMBOSS );
        r( wxTEXT_ATTR_EFFECT_OUTLINE );
        r( wxTEXT_ATTR_EFFECT_ENGRAVE );
        r( wxTEXT_ATTR_EFFECT_SUPERSCRIPT );
        r( wxTEXT_ATTR_EFFECT_SUBSCRIPT );
#endif

#if WXPERL_W_VERSION_GE( 2, 8, 0 )
        r( wxTEXT_ATTR_EFFECTS );
#endif
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
        r( wxTEXT_ATTR_FONT_ENCODING );
#endif
#if WXPERL_W_VERSION_GE( 2, 8, 8 )
        r( wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE );
#endif
#if WXPERL_W_VERSION_GE( 2, 8, 0 )
        r( wxTEXT_ATTR_OUTLINE_LEVEL );
#endif
        break;
    }
#undef r

    WX_PL_CONSTANT_CLEANUP();
}

wxPlConstants richtextctrl_module( &richtextctrl_constant );

%}
%file{-};

%name{Wx::RichTextEvent} class wxRichTextEvent
{
#if WXPERL_W_VERSION_LE( 2, 7, 2 )
    int GetIndex() const;
    void SetIndex( int n );
#endif
    int GetFlags() const;
    void SetFlags( int flags );
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    wxRichTextStyleSheetDisown* GetOldStyleSheet() const;
    void SetOldStyleSheet( wxRichTextStyleSheetDisown* sheet );
    wxRichTextStyleSheetDisown* GetNewStyleSheet() const;
    void SetNewStyleSheet( wxRichTextStyleSheetDisown* sheet );
#endif
};

%name{Wx::RichTextCtrl} class wxRichTextCtrl
{
    %name{newDefault} wxRichTextCtrl()
        %code{% RETVAL = new wxRichTextCtrl();
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};
    %name{newFull} wxRichTextCtrl( wxWindow* parent,
                                   wxWindowID id = wxID_ANY,
                                   const wxString& string = wxEmptyString,
                                   const wxPoint& pos = wxDefaultPosition,
                                   const wxSize& size = wxDefaultSize,
                                   long style = wxRE_MULTILINE )
        %code{% RETVAL = new wxRichTextCtrl( parent, id, string,
                                             pos, size, style );
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};

    bool Create( wxWindow* parent, wxWindowID id = wxID_ANY,
                 const wxString& string = wxEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = wxRE_MULTILINE );

    wxString GetFilename() const;
    void SetFilename( const wxString& filename );
    void SetDelayedLayoutThreshold( long threshold );
    long GetDelayedLayoutThreshold() const;

    %name{SetStyleFromTo} bool SetStyle( long start, long end,
                                         const wxTextAttr& style );
    %name{SetStyleExFromTo} bool SetStyle( long start, long end,
                                           const wxTextAttrEx& style );
    %name{SetStyleRange} bool SetStyle( const wxRichTextRange& range,
                                        const wxRichTextAttr& style );

#if WXPERL_W_VERSION_GE( 2, 7, 1 )
#if WXPERL_W_VERSION_LT( 2, 9, 0 )
    %name{SetStyleExExFromTo} bool SetStyleEx
        ( long start, long end, const wxTextAttrEx& style,
          int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
#endif
    %name{SetStyleExRange} bool SetStyleEx
        ( const wxRichTextRange& range, const wxTextAttrEx& style,
          int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
    %name{SetStyleExExRange} bool SetStyleEx
        ( const wxRichTextRange& range, const wxRichTextAttr& style,
          int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
#endif

    const wxTextAttrEx& GetBasicStyle() const;
    const wxTextAttrEx& GetDefaultStyleEx() const;

    bool Newline();

    bool BeginStyle( const wxTextAttrEx& style );
    bool EndStyle();
    bool EndAllStyles();
    bool BeginBold();
    bool EndBold();
    bool BeginItalic();
    bool EndItalic();
    bool BeginUnderline();
    bool EndUnderline();
    bool BeginFontSize( int pointSize );
    bool EndFontSize();
    bool BeginFont( const wxFont& font );
    bool EndFont();
    bool BeginTextColour( const wxColour& colour );
    bool EndTextColour();
    bool BeginAlignment( wxTextAttrAlignment alignment );
    bool EndAlignment();
    bool BeginLeftIndent( int leftIndent, int leftSubIndent = 0 );
    bool EndLeftIndent();
    bool BeginRightIndent( int rightIndent );
    bool EndRightIndent();
    bool BeginParagraphSpacing( int before, int after );
    bool EndParagraphSpacing();
    bool BeginLineSpacing( int lineSpacing );
    bool EndLineSpacing();
    bool BeginNumberedBullet( int bulletNumber, int leftIndent, 
                              int leftSubIndent,
                              int bulletStyle = wxTEXT_ATTR_DEFAULT_NUMBERED_BULLET );
    bool EndNumberedBullet();
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    bool BeginSymbolBullet( const wxString& symbol, int leftIndent,
                            int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
#else
    bool BeginSymbolBullet( wxChar symbol, int leftIndent,
                            int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
#endif
    bool EndSymbolBullet();
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    bool BeginStandardBullet( const wxString& bulletName, int leftIndent,
                              int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD );
    bool EndStandardBullet();
#endif
    bool BeginCharacterStyle( const wxString& characterStyle );
    bool EndCharacterStyle();
    bool BeginParagraphStyle( const wxString& paragraphStyle );
    bool EndParagraphStyle();
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    bool BeginListStyle( const wxString& listStyle, int level = 1,
                         int number = 1 );
    bool EndListStyle();
    bool BeginURL( const wxString& url,
                   const wxString& characterStyle = wxEmptyString );
    bool EndURL();
#endif
    bool SetDefaultStyleToCursorStyle();
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    bool ClearListStyle( const wxRichTextRange& range,
                         int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO );
#endif
    void SelectNone();
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
    bool SelectWord( long position );
#endif
    wxRichTextRange GetSelectionRange() const;
    void SetSelectionRange( const wxRichTextRange& range );
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
    const wxRichTextRange& GetInternalSelectionRange() const;
    void SetInternalSelectionRange( const wxRichTextRange& range );
#endif
#if WXPERL_W_VERSION_LE( 2, 9, 1 )
    bool HasSelection() const;
#endif
    wxRichTextRange AddParagraph( const wxString& text );
    wxRichTextRange AddImage( const wxImage& image );

    bool LayoutContent( bool onlyVisibleRect = false );
    bool MoveCaret( long pos, bool showAtLineStart = false );
    bool MoveRight( int noPositions = 1, int flags = 0 );
    bool MoveLeft( int noPositions = 1, int flags = 0 );
    bool MoveUp( int noLines = 1, int flags = 0 );
    bool MoveDown( int noLines = 1, int flags = 0 );
    bool MoveToLineEnd( int flags = 0 );
    bool MoveToLineStart( int flags = 0 );
    bool MoveToParagraphEnd( int flags = 0 );
    bool MoveToParagraphStart( int flags = 0 );
    bool MoveHome( int flags = 0 );
    bool MoveEnd( int flags = 0 );
    bool PageUp( int noPages = 1, int flags = 0 );
    bool PageDown( int noPages = 1, int flags = 0 );
    bool WordLeft( int noPages = 1, int flags = 0 );
    bool WordRight( int noPages = 1, int flags = 0 );

    bool BeginBatchUndo( const wxString& cmdName );
    bool EndBatchUndo();
    bool BatchingUndo() const;
    bool BeginSuppressUndo();
    bool EndSuppressUndo();
    bool SuppressingUndo() const;

    bool CanDeleteSelection() const;
    void DeleteSelection();

    %name{HasCAEx}   bool HasCharacterAttributes
        ( const wxRichTextRange& range, const wxTextAttrEx& style ) const;
    %name{HasCARich} bool HasCharacterAttributes
        ( const wxRichTextRange& range, const wxRichTextAttr& style) const;
    %name{HasPAEx}   bool HasParagraphAttributes
        ( const wxRichTextRange& range, const wxTextAttrEx& style) const;
    %name{HasPARich} bool HasParagraphAttributes
        ( const wxRichTextRange& range, const wxRichTextAttr& style) const;

    bool IsSelectionBold();
    bool IsSelectionItalics();
    bool IsSelectionUnderlined();
    bool IsSelectionAligned( wxTextAttrAlignment alignment );
    bool ApplyBoldToSelection();
    bool ApplyItalicToSelection();
    bool ApplyUnderlineToSelection();
    bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment);
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
    bool ApplyStyle( wxRichTextStyleDefinition* def );
    void SetStyleSheet( wxRichTextStyleSheet* styleSheet );
    wxRichTextStyleSheetDisown* GetStyleSheet() const;
    bool ApplyStyleSheet( wxRichTextStyleSheet* styleSheet = NULL );
#endif
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    bool PushStyleSheet( wxRichTextStyleSheetDisown* styleSheet );
    wxRichTextStyleSheetDisown* PopStyleSheet();
#endif

    void PositionCaret();
    bool ExtendSelection( long oldPosition, long newPosition, int flags );
    bool ScrollIntoView( long position, int keyCode );
    void SetCaretPosition( long position, bool showAtLineStart = false );
    long GetCaretPosition() const;

#if WXPERL_W_VERSION_GE( 2, 7, 1 )
    long GetAdjustedCaretPosition( long caretPos ) const;
#endif
    void MoveCaretForward( long oldPosition );
    void MoveCaretBack( long oldPosition );

##    bool GetCaretPositionForIndex( long position, wxRect& rect );
##    bool DeleteSelectedContent( long* newPos= NULL );

    wxPoint GetPhysicalPoint( const wxPoint& ptLogical ) const;
    wxPoint GetLogicalPoint( const wxPoint& ptPhysical ) const;

    long FindNextWordPosition( int direction = 1 ) const;
    bool IsPositionVisible( long pos ) const;
    long GetFirstVisiblePosition() const;
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
    long GetCaretPositionForDefaultStyle() const;
    void SetCaretPositionForDefaultStyle( long pos );
    bool IsDefaultStyleShowing() const;
    void SetAndShowDefaultStyle( const wxRichTextAttr& attr );
#endif
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    wxPoint GetFirstVisiblePoint() const;
#endif

    %name{WriteImageFile} bool WriteImage( const wxString& filename,
                                           wxBitmapType bitmapType );
    %name{WriteImageBitmap} bool WriteImage( const wxBitmap& bitmap,
                                  wxBitmapType bitmapType = wxBITMAP_TYPE_PNG );
    %name{WriteImageImage} bool WriteImage( const wxImage& image,
                                  wxBitmapType bitmapType = wxBITMAP_TYPE_PNG );

    %name{SetBasicStyleRich} void SetBasicStyle( const wxRichTextAttr& style );
    %name{SetBasicStyleEx} void SetBasicStyle( const wxTextAttrEx& style );
    
    %name{SetDefaultStyleEx} bool SetDefaultStyle(const wxTextAttrEx& style);
    %name{SetDefaultStyleDefault} bool SetDefaultStyle(const wxTextAttr& style);
    
%{
void
wxRichTextCtrl::SetBasicStyle( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wrta, SetBasicStyleRich )
        MATCH_REDISP( wxPliOvl_wtae, SetBasicStyleEx )
    END_OVERLOAD( "Wx::RichTextCtrl::SetBasicStyle" )


void
wxRichTextCtrl::SetDefaultStyle( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wtae, SetDefaultStyleEx )
        MATCH_REDISP( wxPliOvl_wtat, SetDefaultStyleDefault )
    END_OVERLOAD( "Wx::RichTextCtrl::SetDefaultStyle" )

%}

    wxRichTextBuffer* GetBuffer()
        %code{% RETVAL = &THIS->GetBuffer(); %}
        %cleanup%{ wxPli_object_set_deleteable( aTHX_ ST(0), false ); %};

};

%{

void
wxRichTextCtrl::new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newDefault )
        MATCH_ANY_REDISP( newFull )
    END_OVERLOAD( "Wx::RichTextCtrl::new" )

void
wxRichTextCtrl::SetStyle( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wrtr_wrta, SetStyleRange )
        MATCH_REDISP( wxPliOvl_n_n_wtae, SetStyleExFromTo )
        MATCH_REDISP( wxPliOvl_n_n_wtat, SetStyleFromTo )
    END_OVERLOAD( "Wx::RichTextCtrl::SetStyle" )

#if WXPERL_W_VERSION_GE( 2, 7, 1 )

void
wxRichTextCtrl::SetStyleEx( ... )
  PPCODE:
    BEGIN_OVERLOAD()
#if WXPERL_W_VERSION_LT( 2, 9, 0 )
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_n_n_wtae, SetStyleExExFromTo, 2 )
#else
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wrtr_wrta_n, SetStyleExExRange, 2 )
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wrtr_wtae_n, SetStyleExRange, 2 )
#endif
    END_OVERLOAD( "Wx::RichTextCtrl::SetStyleEx" )

#endif

void
wxRichTextCtrl::HasCharacterAttributes( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wrtr_wrta, HasCARich )
        MATCH_REDISP( wxPliOvl_wrtr_wtae, HasCAEx )
    END_OVERLOAD( "Wx::RichTextCtrl::HasCharacterAttributes" )

void
wxRichTextCtrl::HasParagraphAttributes( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wrtr_wrta, HasPARich )
        MATCH_REDISP( wxPliOvl_wrtr_wtae, HasPAEx )
    END_OVERLOAD( "Wx::RichTextCtrl::HasParagraphAttributes" )

void
wxRichTextCtrl::DeleteSelectedContent()
  PPCODE:
    long newPos;
    bool retval = THIS->DeleteSelectedContent( &newPos );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( newSViv( retval ? newPos : -1 ) );

void
wxRichTextCtrl::GetCaretPositionForIndex( position )
    long position
  PPCODE:
    wxRect rect;
    bool retval = THIS->GetCaretPositionForIndex( position, rect );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxRect( rect ), "Wx::Rect" ) :
                    &PL_sv_undef );

void
wxRichTextCtrl::GetRichTextAttrStyle( position )
    long position
  PPCODE:
    wxRichTextAttr attr;
    bool retval = THIS->GetStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxRichTextAttr( attr ),
                                           "Wx::RichTextAttr" ) :
                    &PL_sv_undef );

void
wxRichTextCtrl::GetTextAttrExStyle( position )
    long position
  PPCODE:
    wxTextAttrEx attr;
    bool retval = THIS->GetStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttrEx( attr ),
                                           "Wx::TextAttrEx" ) :
                    &PL_sv_undef );

void
wxRichTextCtrl::GetTextAttrStyle( position )
    long position
  PPCODE:
    wxTextAttr attr;
    bool retval = THIS->GetStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttr( attr ),
                                           "Wx::TextAttr" ) :
                    &PL_sv_undef );

#if WXPERL_W_VERSION_GE( 2, 9, 0 )

void
wxRichTextCtrl::GetStyle( position )
    long position
  PPCODE:
    wxTextAttr attr;
    bool retval = THIS->GetStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttr( attr ),
                                           "Wx::TextAttr" ) :
                    &PL_sv_undef );

#endif

#if WXPERL_W_VERSION_GE( 2, 7, 1 )

void
wxRichTextCtrl::GetRichTextAttrUncombinedStyle( position )
    long position
  PPCODE:
    wxRichTextAttr attr;
    bool retval = THIS->GetUncombinedStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxRichTextAttr( attr ),
                                           "Wx::RichTextAttr" ) :
                    &PL_sv_undef );

#endif

#if WXPERL_W_VERSION_GE( 2, 7, 1 ) && WXPERL_W_VERSION_LT( 2, 9, 2 )

void
wxRichTextCtrl::GetTextAttrExUncombinedStyle( position )
    long position
  PPCODE:
    wxTextAttrEx attr;
    bool retval = THIS->GetUncombinedStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttrEx( attr ),
                                           "Wx::TextAttrEx" ) :
                    &PL_sv_undef );

void
wxRichTextCtrl::GetTextAttrUncombinedStyle( position )
    long position
  PPCODE:
    wxTextAttr attr;
    bool retval = THIS->GetUncombinedStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttr( attr ),
                                           "Wx::TextAttr" ) :
                    &PL_sv_undef );

#endif

#if WXPERL_W_VERSION_GE( 2, 9, 0 ) && WXPERL_W_VERSION_LT( 2, 9, 2 )

void
wxRichTextCtrl::GetUncombinedStyle( position )
    long position
  PPCODE:
    wxTextAttr attr;
    bool retval = THIS->GetUncombinedStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttr( attr ),
                                           "Wx::TextAttr" ) :
                    &PL_sv_undef );

#endif

#if WXPERL_W_VERSION_GE( 2, 8, 0 )

void
wxRichTextCtrl::GetRichTextAttrStyleForRange( range )
    wxRichTextRange* range
  PPCODE:
    wxRichTextAttr attr;
    bool retval = THIS->GetStyleForRange( *range, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxRichTextAttr( attr ),
                                           "Wx::RichTextAttr" ) :
                    &PL_sv_undef );

void
wxRichTextCtrl::GetTextAttrExStyleForRange( range )
    wxRichTextRange* range
  PPCODE:
    wxTextAttrEx attr;
    bool retval = THIS->GetStyleForRange( *range, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttrEx( attr ),
                                           "Wx::TextAttrEx" ) :
                    &PL_sv_undef );

#endif

#if WXPERL_W_VERSION_GE( 2, 9, 0 )

void
wxRichTextCtrl::GetStyleForRange( range )
    wxRichTextRange* range
  PPCODE:
    wxTextAttr attr;
    bool retval = THIS->GetStyleForRange( *range, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttrEx( attr ),
                                           "Wx::TextAttrEx" ) :
                    &PL_sv_undef );

#endif

void
WriteImage( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wimg_n, WriteImageImage, 1 )
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_wbmp_n, WriteImageBitmap, 1 )
        MATCH_REDISP( wxPliOvl_s_n, WriteImageFile )
    END_OVERLOAD( "Wx::RichTextCtrl::WriteImage" )

%}

#if WXPERL_W_VERSION_GE( 2, 9, 2 )

#define WXPERL_IN_RICHTEXTCTRL

INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp -t ../../typemap.xsp ../../XS/TextCtrlIface.xsp
INCLUDE_COMMAND: $^X -pe "s/TextCtrlIface/RichTextCtrl/g" xspp/TextCtrlIface.h

#undef WXPERL_IN_RICHTEXTCTRL

#endif