Source

wxPython / src / _richtextctrl.i

   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
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
/////////////////////////////////////////////////////////////////////////////
// Name:        _richtextctrl.i
// Purpose:     wxRichTextCtrl and related classes
//
// Author:      Robin Dunn
//
// Created:     11-April-2006
// RCS-ID:      $Id: _richtextctrl.i 69712 2011-11-08 18:05:56Z RD $
// Copyright:   (c) 2006 by Total Control Software
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////

// Not a %module


//---------------------------------------------------------------------------

%{
%}

//---------------------------------------------------------------------------
%newgroup

enum {
    wxRE_READONLY,
    wxRE_MULTILINE,
    wxRE_CENTER_CARET,
    wxRE_CENTRE_CARET,

    wxRICHTEXT_SHIFT_DOWN,
    wxRICHTEXT_CTRL_DOWN,
    wxRICHTEXT_ALT_DOWN,

#if 0
    wxRICHTEXT_SELECTED,
    wxRICHTEXT_TAGGED,
    wxRICHTEXT_FOCUSSED,
    wxRICHTEXT_IS_FOCUS,
#endif
};


//---------------------------------------------------------------------------

MAKE_CONST_WXSTRING2(RichTextCtrlNameStr, wxT("richText"));

MustHaveApp(wxRichTextCtrl);


DocStr(wxRichTextCtrl,
"", "");


class wxRichTextCtrl : public wxControl,
                       public wxTextCtrlIface,
                       public wxScrollHelper
{
public:
    %pythonAppend wxRichTextCtrl         "self._setOORInfo(self)"
    %pythonAppend wxRichTextCtrl()       ""

    wxRichTextCtrl( wxWindow* parent,
                    wxWindowID id = -1,
                    const wxString& value = wxPyEmptyString,
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize& size = wxDefaultSize,
                    long style = wxRE_MULTILINE,
                    const wxValidator& validator = wxDefaultValidator,
                    const wxString& name = wxPyRichTextCtrlNameStr );
    %RenameCtor(PreRichTextCtrl, wxRichTextCtrl());


    bool Create( wxWindow* parent,
                 wxWindowID id = -1,
                 const wxString& value = wxPyEmptyString,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = wxRE_MULTILINE,
                 const wxValidator& validator = wxDefaultValidator,
                 const wxString& name = wxPyRichTextCtrlNameStr );


    DocDeclStr(
        virtual wxString , GetValue() const,
        "", "");

    DocDeclStr(
        virtual void , SetValue(const wxString& value),
        "", "");


    DocDeclStr(
        virtual wxString , GetRange(long from, long to) const,
        "", "");


    DocDeclStr(
        virtual int , GetLineLength(long lineNo) const ,
        "", "");

    DocDeclStr(
        virtual wxString , GetLineText(long lineNo) const ,
        "", "");

    DocDeclStr(
        virtual int , GetNumberOfLines() const ,
        "", "");


    DocDeclStr(
        virtual bool , IsModified() const ,
        "", "");

    DocDeclStr(
        virtual bool , IsEditable() const ,
        "", "");


    // more readable flag testing methods
    DocDeclStr(
        bool , IsSingleLine() const,
        "", "");

    DocDeclStr(
        bool , IsMultiLine() const,
        "", "");


    DocDeclAStr(
        virtual void , GetSelection(long* OUTPUT, long* OUTPUT) const,
        "GetSelection() --> (start, end)",
        "Returns the start and end positions of the current selection.  If the
values are the same then there is no selection.", "");


    DocDeclStr(
        virtual wxString , GetStringSelection() const,
        "", "");


    DocDeclStr(
        wxString , GetFilename() const,
        "", "");


    DocDeclStr(
        void , SetFilename(const wxString& filename),
        "", "");


    DocDeclStr(
        void , SetDelayedLayoutThreshold(long threshold),
        "Set the threshold in character positions for doing layout optimization
during sizing.", "");


    DocDeclStr(
        long , GetDelayedLayoutThreshold() const,
        "Get the threshold in character positions for doing layout optimization
during sizing.", "");

    bool GetFullLayoutRequired() const;
    void SetFullLayoutRequired(bool b);

    wxLongLong GetFullLayoutTime() const;
    void SetFullLayoutTime(wxLongLong t);

    long GetFullLayoutSavedPosition() const;
    void SetFullLayoutSavedPosition(long p);

    // Force any pending layout due to large buffer
    void ForceDelayedLayout();


    DocDeclStr(
        void , SetTextCursor(const wxCursor& cursor ),
        "Set text cursor", "");
    

    DocDeclStr(
        wxCursor , GetTextCursor() const,
        "Get text cursor", "");
    

    DocDeclStr(
        void , SetURLCursor(const wxCursor& cursor ),
        "Set URL cursor", "");
    

    DocDeclStr(
        wxCursor , GetURLCursor() const,
        "Get URL cursor", "");

    
    /// Are we showing the caret position at the start of a line
    /// instead of at the end of the previous one?
    bool GetCaretAtLineStart() const;
    void SetCaretAtLineStart(bool atStart);

    /// Are we dragging a selection?
    bool GetDragging() const;
    void SetDragging(bool dragging);

    /// Get/set drag start position
    const wxPoint& GetDragStart() const;
    void SetDragStart(const wxPoint& pt);

#ifdef __WXMSW__
    /// Get the buffer bitmap
    wxBitmap& GetBufferBitmap();
#endif

    /// Get/set context menu
    wxMenu* GetContextMenu() const;
    void SetContextMenu(wxMenu* menu);

    /// Anchor so we know how to extend the selection
    /// It's a caret position since it's between two characters.
    long GetSelectionAnchor() const;
    void SetSelectionAnchor(long anchor);

    

    DocDeclStr(
        virtual void , Clear(),
        "", "");

    DocDeclStr(
        virtual void , Replace(long from, long to, const wxString& value),
        "", "");

    DocDeclStr(
        virtual void , Remove(long from, long to),
        "", "");


    DocDeclStr(
        virtual bool , LoadFile(const wxString& file, int type = wxRICHTEXT_TYPE_ANY),
        "Load the contents of the document from the given filename.", "");

    DocDeclStr(
        virtual bool , SaveFile(const wxString& file = wxPyEmptyString,
                                int type = wxRICHTEXT_TYPE_ANY),
        "Save the contents of the document to the given filename, or if the
empty string is passed then to the filename set with `SetFilename`.", "");


    DocDeclStr(
        void , SetHandlerFlags(int flags), 
        "Set the handler flags, controlling loading and saving.", "");

    DocDeclStr(
        int , GetHandlerFlags() const, 
        "Get the handler flags, controlling loading and saving.", "");

    // sets/clears the dirty flag
    DocDeclStr(
        virtual void , MarkDirty(),
        "Sets the dirty flag, meaning that the contents of the control have
changed and need to be saved.", "");

    DocDeclStr(
        virtual void , DiscardEdits(),
        "Clears the dirty flag.
:see: `MarkDirty`", "");


    DocDeclStr(
        virtual void , SetMaxLength(unsigned long len),
        "Set the max number of characters which may be entered in a single line
text control.", "");


    DocDeclStr(
        virtual void , WriteText(const wxString& text),
        "Insert text at the current position.", "");

    DocDeclStr(
        virtual void , AppendText(const wxString& text),
        "Append text to the end of the document.", "");


    DocDeclStr(
        virtual bool , SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style),
        "Set the style for the text in ``range`` to ``style``", "");

    DocDeclStr(
        virtual bool , GetStyle(long position, wxRichTextAttr& style),
        "Retrieve the style used at the given position.  Copies the style
values at ``position`` into the ``style`` parameter and returns ``True``
if successful.  Returns ``False`` otherwise.", "");


    DocDeclStr(
        virtual bool , GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style),
        "Get the common set of styles for the range", "");
    

    DocDeclStr(
        virtual bool , SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style,
                                  int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO),
        "Extended style setting operation with flags including:
RICHTEXT_SETSTYLE_WITH_UNDO, RICHTEXT_SETSTYLE_OPTIMIZE,
RICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, RICHTEXT_SETSTYLE_CHARACTERS_ONLY", "");
    

    
    DocDeclStr(
        virtual bool , GetUncombinedStyle(long position, wxRichTextAttr& style),
        "Get the content (uncombined) attributes for this position.  Copies the
style values at ``position`` into the ``style`` parameter and returns
``True`` if successful.  Returns ``False`` otherwise.", "");


    DocDeclStr(
        virtual bool , SetDefaultStyle(const wxRichTextAttr& style),
        "Set the style used by default for the rich text document.", "");


    DocDeclStrName(
        virtual const wxRichTextAttr , GetDefaultStyleEx() const,
        "Retrieves a copy of the default style object.", "",
        GetDefaultStyle);


// TODO:  Select which of these to keep or rename
    
    /// Set list style
//     virtual bool SetListStyle(const wxRichTextRange& range,
//                               wxRichTextListStyleDefinition* def,
//                               int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
//                               int startFrom = 1, int specifiedLevel = -1);
    virtual bool SetListStyle(const wxRichTextRange& range,
                              const wxString& defName,
                              int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
                              int startFrom = 1, int specifiedLevel = -1);

    /// Clear list for given range
    virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);

    /// Number/renumber any list elements in the given range
    /// def/defName can be NULL/empty to indicate that the existing list style should be used.
//     virtual bool NumberList(const wxRichTextRange& range,
//                             wxRichTextListStyleDefinition* def = NULL,
//                             int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
//                             int startFrom = 1, int specifiedLevel = -1);
    virtual bool NumberList(const wxRichTextRange& range,
                            const wxString& defName,
                            int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
                            int startFrom = 1, int specifiedLevel = -1);

    /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
    /// def/defName can be NULL/empty to indicate that the existing list style should be used.
//     virtual bool PromoteList(int promoteBy, const wxRichTextRange& range,
//                              wxRichTextListStyleDefinition* def = NULL,
//                              int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
//                              int specifiedLevel = -1);
    virtual bool PromoteList(int promoteBy, const wxRichTextRange& range,
                             const wxString& defName,
                             int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
                             int specifiedLevel = -1);

    /// Deletes the content in the given range
    virtual bool Delete(const wxRichTextRange& range);


    

    DocDeclStr(
        virtual long , XYToPosition(long x, long y) const,
        "Translate a col,row coordinants into a document position.", "");

    DocDeclAStr(
        virtual void , PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const,
        "PositionToXY(self, long pos) --> (x, y)",
        "Retrieves the col,row for the given position within the document", "");


    DocDeclStr(
        virtual void , ShowPosition(long position),
        "Ensure that the given position in the document is visible.", "");


    DocDeclAStr(
        virtual wxTextCtrlHitTestResult , HitTest(const wxPoint& pt, long *OUTPUT) const,
        "HitTest(self, Point pt) --> (result, pos)",
        "Returns the character position at the given point in pixels.  Note
that ``pt`` should be given in device coordinates, and not be adjusted
for the client area origin nor for scrolling.  The return value is a
tuple of the hit test result and the position.", "

Possible result values are a bitmask of these flags:

    =========================  ====================================
    RICHTEXT_HITTEST_NONE      The point was not on this object.
    RICHTEXT_HITTEST_BEFORE    The point was before the position
                                  returned from HitTest.
    RICHTEXT_HITTEST_AFTER     The point was after the position
                               returned from HitTest.
    RICHTEXT_HITTEST_ON        The point was on the position
                               returned from HitTest
    =========================  ====================================
");

    DocDeclAStrName(
        virtual wxTextCtrlHitTestResult , HitTest(const wxPoint& pt,
                                                  wxTextCoord *OUTPUT,
                                                  wxTextCoord *OUTPUT) const,
        "HitTestRC(self, Point pt) --> (result, col, row)",
        "Returns the column and row of the given point in pixels.  Note that
``pt`` should be given in device coordinates, and not be adjusted for
the client area origin nor for scrolling.  The return value is a tuple
of the hit test result and the column and row values.", "
:see: `HitTest`",
        HitTestXY);


    // Clipboard operations
    DocDeclStr(
        virtual void , Copy(),
        "Copies the selected text to the clipboard.", "");

    DocDeclStr(
        virtual void , Cut(),
        "Copies the selected text to the clipboard and removes the selection.", "");

    DocDeclStr(
        virtual void , Paste(),
        "Pastes text from the clipboard into the document at the current
insertion point.", "");

    DocDeclStr(
        virtual void , DeleteSelection(),
        "Remove the current selection.", "");


    DocDeclStr(
        virtual bool , CanCopy() const,
        "Returns ``True`` if the selection can be copied to the clipboard.", "");

    DocDeclStr(
        virtual bool , CanCut() const,
        "Returns ``True`` if the selection can be cut to the clipboard.", "");

    DocDeclStr(
        virtual bool , CanPaste() const,
        "Returns ``True`` if the current contents of the clipboard can be
pasted into the document.", "");

    DocDeclStr(
        virtual bool , CanDeleteSelection() const,
        "Returns ``True`` if the selection can be removed from the document.", "");


    // Undo/redo
    DocDeclStr(
        virtual void , Undo(),
        "If the last operation can be undone, undoes the last operation.", "");

    DocDeclStr(
        virtual void , Redo(),
        "If the last operation can be redone, redoes the last operation.", "");


    DocDeclStr(
        virtual bool , CanUndo() const,
        "Returns ``True`` if the last operation can be undone.", "");

    DocDeclStr(
        virtual bool , CanRedo() const,
        "Returns ``True`` if the last operation can be redone.", "");


    // Insertion point
    DocDeclStr(
        virtual void , SetInsertionPoint(long pos),
        "Sets the insertion point at the given position.", "");

    DocDeclStr(
        virtual void , SetInsertionPointEnd(),
        "Moves the insertion point to the end of the document.", "");

    DocDeclStr(
        virtual long , GetInsertionPoint() const,
        "Returns the insertion point. This is defined as the zero based index
of the character position to the right of the insertion point.", "");

    DocDeclStr(
        virtual long , GetLastPosition() const,
        "Returns the zero based index of the last position in the document.", "");


    DocDeclStr(
        virtual void , SetSelection(long from, long to),
        "Selects the text starting at the first position up to (but not
including) the character at the last position. If both parameters are
equal to -1 then all text in the control is selected.", "");

    DocDeclStr(
        virtual void , SelectAll(),
        "Select all text in the document.", "");

    DocDeclStr(
        virtual void , SetEditable(bool editable),
        "Makes the document editable or read-only, overriding the RE_READONLY
flag.", "");


    DocDeclStr(
        virtual bool , HasSelection() const,
        "", "");


///// Functionality specific to wxRichTextCtrl

    DocDeclStr(
        virtual bool , WriteImage(const wxImage& image,
                                  wxBitmapType bitmapType = wxBITMAP_TYPE_PNG),
        "Write an image at the current insertion point. Supply optional type to
use for internal and file storage of the raw data.
", "");


    DocDeclStrName(
        virtual bool , WriteImage(const wxBitmap& bitmap,
                                  wxBitmapType bitmapType = wxBITMAP_TYPE_PNG),
        "Write a bitmap at the current insertion point. Supply optional type to
use for internal and file storage of the raw data.", "",
        WriteBitmap);


    DocDeclStrName(
        virtual bool , WriteImage(const wxString& filename,
                                  wxBitmapType bitmapType),
        "Load an image from file and write at the current insertion point.", "",
        WriteImageFile);


    DocDeclStrName(
        virtual bool , WriteImage(const wxRichTextImageBlock& imageBlock),
        "Write an image block at the current insertion point.", "",
        WriteImageBlock);


    DocDeclStr(
        virtual bool , Newline(),
        "Insert a newline (actually paragraph) at the current insertion point.", "");


    DocDeclStr(
        virtual bool , LineBreak(),
        "Insert a line break at the current insertion point.", "");
    

    
    DocDeclStr(
        virtual void , SetBasicStyle(const wxRichTextAttr& style),
        "", "");


    DocDeclStr(
        virtual const wxRichTextAttr , GetBasicStyle() const,
        "Get basic (overall) style", "");


    DocDeclStr(
        virtual bool , BeginStyle(const wxRichTextAttr& style),
        "Begin using a style", "");

    
    DocDeclStr(
        virtual bool , EndStyle(),
        "End the style", "");


    DocDeclStr(
        virtual bool , EndAllStyles(),
        "End all styles", "");


    DocDeclStr(
        bool , BeginBold(),
        "Begin using bold", "");


    DocDeclStr(
        bool , EndBold(),
        "End using bold", "");


    DocDeclStr(
        bool , BeginItalic(),
        "Begin using italic", "");


    DocDeclStr(
        bool , EndItalic(),
        "End using italic", "");


    DocDeclStr(
        bool , BeginUnderline(),
        "Begin using underline", "");


    DocDeclStr(
        bool , EndUnderline(),
        "End using underline", "");


    DocDeclStr(
        bool , BeginFontSize(int pointSize),
        "Begin using point size", "");


    DocDeclStr(
        bool , EndFontSize(),
        "End using point size", "");


    DocDeclStr(
        bool , BeginFont(const wxFont& font),
        "Begin using this font", "");


    DocDeclStr(
        bool , EndFont(),
        "End using a font", "");


    DocDeclStr(
        bool , BeginTextColour(const wxColour& colour),
        "Begin using this colour", "");


    DocDeclStr(
        bool , EndTextColour(),
        "End using a colour", "");


    DocDeclStr(
        bool , BeginAlignment(wxTextAttrAlignment alignment),
        "Begin using alignment", "");


    DocDeclStr(
        bool , EndAlignment(),
        "End alignment", "");


    DocDeclStr(
        bool , BeginLeftIndent(int leftIndent, int leftSubIndent = 0),
        "Begin left indent", "");


    DocDeclStr(
        bool , EndLeftIndent(),
        "End left indent", "");


    DocDeclStr(
        bool , BeginRightIndent(int rightIndent),
        "Begin right indent", "");


    DocDeclStr(
        bool , EndRightIndent(),
        "End right indent", "");


    DocDeclStr(
        bool , BeginParagraphSpacing(int before, int after),
        "Begin paragraph spacing", "");


    DocDeclStr(
        bool , EndParagraphSpacing(),
        "End paragraph spacing", "");


    DocDeclStr(
        bool , BeginLineSpacing(int lineSpacing),
        "Begin line spacing", "");


    DocDeclStr(
        bool , EndLineSpacing(),
        "End line spacing", "");


    DocDeclStr(
        bool , BeginNumberedBullet(int bulletNumber,
                                   int leftIndent,
                                   int leftSubIndent,
                                   int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD),
        "Begin numbered bullet", "");


    DocDeclStr(
        bool , EndNumberedBullet(),
        "End numbered bullet", "");


    DocDeclStr(
        bool , BeginSymbolBullet(const wxString& symbol,
                                 int leftIndent,
                                 int leftSubIndent,
                                 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL),
        "Begin symbol bullet", "");


    DocDeclStr(
        bool , EndSymbolBullet(),
        "End symbol bullet", "");


    DocDeclStr(
        bool , BeginStandardBullet(const wxString& bulletName,
                                   int leftIndent,
                                   int leftSubIndent,
                                   int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD),
        "Begin standard bullet", "");
    


    DocDeclStr(
        bool , EndStandardBullet(),
        "End standard bullet", "");
    
    
    DocDeclStr(
        bool , BeginCharacterStyle(const wxString& characterStyle),
        "Begin named character style", "");


    DocDeclStr(
        bool , EndCharacterStyle(),
        "End named character style", "");


    DocDeclStr(
        bool , BeginParagraphStyle(const wxString& paragraphStyle),
        "Begin named paragraph style", "");


    DocDeclStr(
        bool , EndParagraphStyle(),
        "End named character style", "");


    DocDeclStr(
        bool , BeginListStyle(const wxString& listStyle, int level = 1, int number = 1),
        "Begin named list style.", "");
        
    DocDeclStr(
        bool , EndListStyle(), "End named list style.", "");

    DocDeclStr(
        bool , BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString),
            "Begin URL.", "");
    
    DocDeclStr(
        bool , EndURL(), "End URL.", "");

    DocDeclStr(
        bool , SetDefaultStyleToCursorStyle(),
        "Sets the default style to the style under the cursor", "");


    DocDeclStr(
        virtual void , SelectNone(),
        "Clear the selection", "");


    DocDeclStr(
        virtual bool , SelectWord(long position),
        "Select the word at the given character position", "");


    DocDeclStr(
        wxRichTextRange , GetSelectionRange() const,
        "Get the selection range in character positions.", "");

    DocDeclStr(
        void , SetSelectionRange(const wxRichTextRange& range),
        "Set the selection range in character positions. The end point of range
is specified as the last character position of the span of text, plus
one. So, for example, to set the selection for a character at position
5, use the range (5,6).", "");


    DocDeclStr(
        const wxRichTextRange& , GetInternalSelectionRange() const,
        "Get the selection range in character positions. The range is in
internal format, i.e. a single character selection is denoted by (n,n).
", "");

    DocDeclStr(
        void , SetInternalSelectionRange(const wxRichTextRange& range),
        "Set the selection range in character positions. The range is in
internal format, i.e. a single character selection is denoted by (n,n).", "");



    DocDeclStr(
        virtual wxRichTextRange , AddParagraph(const wxString& text),
        "Add a new paragraph of text to the end of the buffer", "");


    DocDeclStr(
        virtual wxRichTextRange , AddImage(const wxImage& image),
        "Add an image", "");


    DocDeclStr(
        virtual bool , LayoutContent(bool onlyVisibleRect = false),
        "Layout the buffer: which we must do before certain operations, such as
setting the caret position.", "");


    DocDeclStr(
        virtual bool , MoveCaret(long pos, bool showAtLineStart = false),
        "Move the caret to the given character position", "");


    DocDeclStr(
        virtual bool , MoveRight(int noPositions = 1, int flags = 0),
        "Move right", "");


    DocDeclStr(
        virtual bool , MoveLeft(int noPositions = 1, int flags = 0),
        "Move left", "");


    DocDeclStr(
        virtual bool , MoveUp(int noLines = 1, int flags = 0),
        "Move up", "");


    DocDeclStr(
        virtual bool , MoveDown(int noLines = 1, int flags = 0),
        "Move down", "");


    DocDeclStr(
        virtual bool , MoveToLineEnd(int flags = 0),
        "Move to the end of the line", "");


    DocDeclStr(
        virtual bool , MoveToLineStart(int flags = 0),
        "Move to the start of the line", "");


    DocDeclStr(
        virtual bool , MoveToParagraphEnd(int flags = 0),
        "Move to the end of the paragraph", "");


    DocDeclStr(
        virtual bool , MoveToParagraphStart(int flags = 0),
        "Move to the start of the paragraph", "");


    DocDeclStr(
        virtual bool , MoveHome(int flags = 0),
        "Move to the start of the buffer", "");


    DocDeclStr(
        virtual bool , MoveEnd(int flags = 0),
        "Move to the end of the buffer", "");


    DocDeclStr(
        virtual bool , PageUp(int noPages = 1, int flags = 0),
        "Move n pages up", "");


    DocDeclStr(
        virtual bool , PageDown(int noPages = 1, int flags = 0),
        "Move n pages down", "");


    DocDeclStr(
        virtual bool , WordLeft(int noPages = 1, int flags = 0),
        "Move n words left", "");


    DocDeclStr(
        virtual bool , WordRight(int noPages = 1, int flags = 0),
        "Move n words right", "");


    DocDeclStr(
        wxRichTextBuffer& , GetBuffer(),
        "Returns the buffer associated with the control.
", "");


    DocDeclStr(
        virtual bool , BeginBatchUndo(const wxString& cmdName),
        "Start batching undo history for commands", "");


    DocDeclStr(
        virtual bool , EndBatchUndo(),
        "End batching undo history for commands.", "");


    DocDeclStr(
        virtual bool , BatchingUndo() const,
        "Are we batching undo history for commands?", "");


    DocDeclStr(
        virtual bool , BeginSuppressUndo(),
        "Start suppressing undo history for commands.", "");


    DocDeclStr(
        virtual bool , EndSuppressUndo(),
        "End suppressing undo history for commands.", "");


    DocDeclStr(
        virtual bool , SuppressingUndo() const,
        "Are we suppressing undo history for commands?", "");


    DocDeclStr(
        virtual bool , HasCharacterAttributes(const wxRichTextRange& range,
                                              const wxRichTextAttr& style) const,
        "Test if this whole range has character attributes of the specified
kind. If any of the attributes are different within the range, the
test fails. You can use this to implement, for example, bold button
updating. ``style`` must have flags indicating which attributes are of
interest.
", "");



    DocDeclStr(
        virtual bool , HasParagraphAttributes(const wxRichTextRange& range,
                                              const wxRichTextAttr& style) const,
        "Test if this whole range has paragraph attributes of the specified
kind. If any of the attributes are different within the range, the
test fails. You can use this to implement, for example, centering
button updating. style must have flags indicating which attributes are
of interest.
", "");



    DocDeclStr(
        virtual bool , IsSelectionBold(),
        "Is all of the selection bold?", "");


    DocDeclStr(
        virtual bool , IsSelectionItalics(),
        "Is all of the selection italics?", "");


    DocDeclStr(
        virtual bool , IsSelectionUnderlined(),
        "Is all of the selection underlined?", "");

        virtual bool DoesSelectionHaveTextEffectFlag(int flag);


    DocDeclStr(
        virtual bool , IsSelectionAligned(wxTextAttrAlignment alignment),
        "Is all of the selection aligned according to the specified flag?", "");


    DocDeclStr(
        virtual bool , ApplyBoldToSelection(),
        "Apply bold to the selection", "");


    DocDeclStr(
        virtual bool , ApplyItalicToSelection(),
        "Apply italic to the selection", "");


    DocDeclStr(
        virtual bool , ApplyUnderlineToSelection(),
        "Apply underline to the selection", "");

    virtual bool ApplyTextEffectToSelection(int flags);

    DocDeclStr(
        virtual bool , ApplyAlignmentToSelection(wxTextAttrAlignment alignment),
        "Apply alignment to the selection", "");


    DocDeclStr(
        virtual bool , ApplyStyle(wxRichTextStyleDefinition* def),
        "Apply a named style to the selection", "");
    

    DocDeclStr(
        void , SetStyleSheet(wxRichTextStyleSheet* styleSheet),
        "Set style sheet, if any.", "");

    DocDeclStr(
        wxRichTextStyleSheet* , GetStyleSheet() const,
        "", "");


    DocDeclStr(
        bool , PushStyleSheet(wxRichTextStyleSheet* styleSheet),
        "Push style sheet to top of stack", "");
    

    
    DocDeclStr(
        wxRichTextStyleSheet* , PopStyleSheet(),
        "Pop style sheet from top of stack", "");
    

    
    DocDeclStr(
        bool , ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL),
        "Apply the style sheet to the buffer, for example if the styles have
changed.", "");



    %property(Buffer, GetBuffer);
    %property(DelayedLayoutThreshold, GetDelayedLayoutThreshold, SetDelayedLayoutThreshold);
    %property(Filename, GetFilename, SetFilename);
    %property(InternalSelectionRange, GetInternalSelectionRange, SetInternalSelectionRange);
    %property(SelectionRange, GetSelectionRange, SetSelectionRange);
    %property(StyleSheet, GetStyleSheet, SetStyleSheet);
    %property(TextCursor, GetTextCursor, SetTextCursor);
    %property(URLCursor, GetURLCursor, SetURLCursor);


    /// Set up scrollbars, e.g. after a resize
    virtual void SetupScrollbars(bool atTop = false);

    /// Keyboard navigation
    virtual bool KeyboardNavigate(int keyCode, int flags);

    /// Position the caret
    virtual void PositionCaret();

    /// Extend the selection, returning true if the selection was
    /// changed. Selections are in caret positions.
    virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);

    /// Scroll into view. This takes a _caret_ position.
    virtual bool ScrollIntoView(long position, int keyCode);

    /// The caret position is the character position just before the caret.
    /// A value of -1 means the caret is at the start of the buffer.
    void SetCaretPosition(long position, bool showAtLineStart = false) ;
    long GetCaretPosition() const;

    /// The adjusted caret position is the character position adjusted to take
    /// into account whether we're at the start of a paragraph, in which case
    /// style information should be taken from the next position, not current one.
    long GetAdjustedCaretPosition(long caretPos) const;

    /// Move caret one visual step forward: this may mean setting a flag
    /// and keeping the same position if we're going from the end of one line
    /// to the start of the next, which may be the exact same caret position.
    void MoveCaretForward(long oldPosition) ;

    /// Move caret one visual step forward: this may mean setting a flag
    /// and keeping the same position if we're going from the end of one line
    /// to the start of the next, which may be the exact same caret position.
    void MoveCaretBack(long oldPosition) ;

    /// Get the caret height and position for the given character position
    bool GetCaretPositionForIndex(long position, wxRect& rect);

    /// Gets the line for the visible caret position. If the caret is
    /// shown at the very end of the line, it means the next character is actually
    /// on the following line. So let's get the line we're expecting to find
    /// if this is the case.
    wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;

    /// Gets the command processor
    wxCommandProcessor* GetCommandProcessor() const;

    /// Delete content if there is a selection, e.g. when pressing a key.
    /// Returns the new caret position in newPos, or leaves it if there
    /// was no action.
    bool DeleteSelectedContent(long* OUTPUT);

    /// Transform logical to physical
    wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;

    /// Transform physical to logical
    wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;

    /// Finds the caret position for the next word. Direction
    /// is 1 (forward) or -1 (backwards).
    virtual long FindNextWordPosition(int direction = 1) const;

    /// Is the given position visible on the screen?
    bool IsPositionVisible(long pos) const;

    /// Returns the first visible position in the current view
    long GetFirstVisiblePosition() const;

    /// Returns the caret position since the default formatting was changed. As
    /// soon as this position changes, we no longer reflect the default style
    /// in the UI. A value of -2 means that we should only reflect the style of the
    /// content under the caret.
    long GetCaretPositionForDefaultStyle() const;

    /// Set the caret position for the default style that the user is selecting.
    void SetCaretPositionForDefaultStyle(long pos);

    /// Should the UI reflect the default style chosen by the user, rather than the style under
    /// the caret?
    bool IsDefaultStyleShowing() const;

    /// Convenience function that tells the control to start reflecting the default
    /// style, since the user is changing it.
    void SetAndShowDefaultStyle(const wxRichTextAttr& attr);

    /// Get the first visible point in the window
    wxPoint GetFirstVisiblePoint() const;

    
    //-------------------------------------------------------------
    // Methods from wxScrollHelper

    // configure the scrolling
    virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
                               int noUnitsX, int noUnitsY,
                               int xPos = 0, int yPos = 0,
                               bool noRefresh = false );

    // scroll to the given (in logical coords) position
    virtual void Scroll(int x, int y);

    // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
    int GetScrollPageSize(int orient) const;
    void SetScrollPageSize(int orient, int pageSize);

//     // get the number of lines the window can scroll, 
//     // returns 0 if no scrollbars are there.
//     int GetScrollLines( int orient ) const;
    
    // Set the x, y scrolling increments.
    void SetScrollRate( int xstep, int ystep );

    DocDeclAStr(
        virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const,
        "GetScrollPixelsPerUnit() -> (xUnit, yUnit)",
        "Get the size of one logical unit in physical units.", "");

    // Enable/disable Windows scrolling in either direction. If True, wxWindows
    // scrolls the canvas and only a bit of the canvas is invalidated; no
    // Clear() is necessary. If False, the whole canvas is invalidated and a
    // Clear() is necessary. Disable for when the scroll increment is used to
    // actually scroll a non-constant distance
    virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);


    DocDeclAStr( 
        virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const,
        "GetViewStart() -> (x,y)",
        "Get the view start", "");
    
    // Set the scale factor, used in PrepareDC
    void SetScale(double xs, double ys);
    double GetScaleX() const;
    double GetScaleY() const;


    %nokwargs CalcScrolledPosition;
    %nokwargs CalcUnscrolledPosition;
    
    DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
    wxPoint CalcScrolledPosition(const wxPoint& pt) const;
    DocDeclA(
        void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
        "CalcScrolledPosition(int x, int y) -> (sx, sy)");

    
    DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
    wxPoint CalcUnscrolledPosition(const wxPoint& pt) const;
    DocDeclA(
        void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
        "CalcUnscrolledPosition(int x, int y) -> (ux, uy)");


    
// TODO: use directors?
//     virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
//     virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;

    // Adjust the scrollbars
    virtual void AdjustScrollbars();

    // Calculate scroll increment
    virtual int CalcScrollInc(wxScrollWinEvent& event);

    // Normally the wxScrolledWindow will scroll itself, but in some rare
    // occasions you might want it to scroll [part of] another window (e.g. a
    // child of it in order to scroll only a portion the area between the
    // scrollbars (spreadsheet: only cell area will move).
    virtual void SetTargetWindow(wxWindow *target);
    virtual wxWindow *GetTargetWindow() const;

#ifndef __WXGTK__
    void SetTargetRect(const wxRect& rect);
    wxRect GetTargetRect() const;
#endif


    
    //------------------------------------------------------------
    // Methods from wxtextCtrlBase
    
    virtual bool IsEmpty() const;
    virtual void ChangeValue(const wxString &value);
    void SetModified(bool modified);
    
    // insert the character which would have resulted from this key event,
    // return True if anything has been inserted
//    virtual bool EmulateKeyPress(const wxKeyEvent& event);

};


//---------------------------------------------------------------------------
%newgroup


%constant wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_CLICK;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_RETURN;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_CHARACTER;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_DELETE;

%constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED;

%constant wxEventType wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED;
%constant wxEventType wxEVT_COMMAND_RICHTEXT_BUFFER_RESET;

%pythoncode {
EVT_RICHTEXT_LEFT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, 1)
EVT_RICHTEXT_RIGHT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, 1)
EVT_RICHTEXT_MIDDLE_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, 1)
EVT_RICHTEXT_LEFT_DCLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, 1)
EVT_RICHTEXT_RETURN = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_RETURN, 1)
EVT_RICHTEXT_CHARACTER = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_CHARACTER, 1)
EVT_RICHTEXT_DELETE = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_DELETE, 1)

EVT_RICHTEXT_STYLESHEET_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, 1)
EVT_RICHTEXT_STYLESHEET_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, 1)
EVT_RICHTEXT_STYLESHEET_REPLACING = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, 1)
EVT_RICHTEXT_STYLESHEET_REPLACED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, 1)

EVT_RICHTEXT_CONTENT_INSERTED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, 1)
EVT_RICHTEXT_CONTENT_DELETED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, 1)
EVT_RICHTEXT_STYLE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, 1)
EVT_RICHTEXT_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, 1)    
EVT_RICHTEXT_BUFFER_RESET = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, 1)
}


class wxRichTextEvent : public wxNotifyEvent
{
public:
    wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);

    int GetPosition() const;
    void SetPosition(int n);

    int GetFlags() const;
    void SetFlags(int flags);

    wxRichTextStyleSheet* GetOldStyleSheet() const;
    void SetOldStyleSheet(wxRichTextStyleSheet* sheet);

    wxRichTextStyleSheet* GetNewStyleSheet() const;
    void SetNewStyleSheet(wxRichTextStyleSheet* sheet);

    const wxRichTextRange& GetRange() const;
    void SetRange(const wxRichTextRange& range);

    wxChar GetCharacter() const;
    void SetCharacter(wxChar ch);

    
    %property(Flags, GetFlags, SetFlags);
    %property(Index, GetPosition, SetPosition);
    %property(OldStyleSheet, GetOldStyleSheet, SetOldStyleSheet);
    %property(NewStyleSheet, GetNewStyleSheet, SetNewStyleSheet);
    %property(Range, GetRange, SetRange);
    %property(Character, GetCharacter, SetCharacter);
};


//---------------------------------------------------------------------------