1//--------------------------------------------------------------------------- 2// This file is generated by wxPython's SIP generator. Do not edit by hand. 3// 4// Copyright: (c) 2018 by Total Control Software 5// License: wxWindows License 6// 7// This file will be included by _richtext.sip 8// 9//--------------------------------------------------------------------------- 10 11%ModuleHeaderCode 12#include <wx/richtext/richtextbuffer.h> 13%End 14 15 16//--------------------------------------------------------------------------- 17 18 // forward declarations 19 class wxRichTextFloatCollector; 20 21 22const int wxRICHTEXT_FIXED_WIDTH; 23const int wxRICHTEXT_FIXED_HEIGHT; 24const int wxRICHTEXT_VARIABLE_WIDTH; 25const int wxRICHTEXT_VARIABLE_HEIGHT; 26const int wxRICHTEXT_LAYOUT_SPECIFIED_RECT; 27const int wxRICHTEXT_DRAW_IGNORE_CACHE; 28const int wxRICHTEXT_DRAW_SELECTED; 29const int wxRICHTEXT_DRAW_PRINT; 30const int wxRICHTEXT_DRAW_GUIDELINES; 31const int wxRICHTEXT_FORMATTED; 32const int wxRICHTEXT_UNFORMATTED; 33const int wxRICHTEXT_CACHE_SIZE; 34const int wxRICHTEXT_HEIGHT_ONLY; 35const int wxRICHTEXT_SETSTYLE_NONE; 36const int wxRICHTEXT_SETSTYLE_WITH_UNDO; 37const int wxRICHTEXT_SETSTYLE_OPTIMIZE; 38const int wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY; 39const int wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY; 40const int wxRICHTEXT_SETSTYLE_RENUMBER; 41const int wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL; 42const int wxRICHTEXT_SETSTYLE_RESET; 43const int wxRICHTEXT_SETSTYLE_REMOVE; 44const int wxRICHTEXT_SETPROPERTIES_NONE; 45const int wxRICHTEXT_SETPROPERTIES_WITH_UNDO; 46const int wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY; 47const int wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY; 48const int wxRICHTEXT_SETPROPERTIES_RESET; 49const int wxRICHTEXT_SETPROPERTIES_REMOVE; 50const int wxRICHTEXT_INSERT_NONE; 51const int wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE; 52const int wxRICHTEXT_INSERT_INTERACTIVE; 53const int wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE; 54const float wxSCRIPT_MUL_FACTOR; 55const int wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET; 56const int wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY; 57const int wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES; 58const int wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64; 59const int wxRICHTEXT_HANDLER_NO_HEADER_FOOTER; 60const int wxRICHTEXT_HANDLER_CONVERT_FACENAMES; 61enum wxRichTextFileType 62{ 63 wxRICHTEXT_TYPE_ANY, 64 wxRICHTEXT_TYPE_TEXT, 65 wxRICHTEXT_TYPE_XML, 66 wxRICHTEXT_TYPE_HTML, 67 wxRICHTEXT_TYPE_RTF, 68 wxRICHTEXT_TYPE_PDF 69}; 70 71enum wxRichTextHitTestFlags 72{ 73 wxRICHTEXT_HITTEST_NONE, 74 wxRICHTEXT_HITTEST_BEFORE, 75 wxRICHTEXT_HITTEST_AFTER, 76 wxRICHTEXT_HITTEST_ON, 77 wxRICHTEXT_HITTEST_OUTSIDE, 78 wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS, 79 wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS, 80 wxRICHTEXT_HITTEST_HONOUR_ATOMIC 81}; 82 83enum wxTextBoxAttrFlags 84{ 85 wxTEXT_BOX_ATTR_FLOAT, 86 wxTEXT_BOX_ATTR_CLEAR, 87 wxTEXT_BOX_ATTR_COLLAPSE_BORDERS, 88 wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT 89}; 90 91enum wxTextAttrValueFlags 92{ 93 wxTEXT_ATTR_VALUE_VALID, 94 wxTEXT_ATTR_VALUE_VALID_MASK 95}; 96 97enum wxTextAttrUnits 98{ 99 wxTEXT_ATTR_UNITS_TENTHS_MM, 100 wxTEXT_ATTR_UNITS_PIXELS, 101 wxTEXT_ATTR_UNITS_PERCENTAGE, 102 wxTEXT_ATTR_UNITS_POINTS, 103 wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT, 104 wxTEXT_ATTR_UNITS_MASK 105}; 106 107enum wxTextBoxAttrPosition 108{ 109 wxTEXT_BOX_ATTR_POSITION_STATIC, 110 wxTEXT_BOX_ATTR_POSITION_RELATIVE, 111 wxTEXT_BOX_ATTR_POSITION_ABSOLUTE, 112 wxTEXT_BOX_ATTR_POSITION_FIXED, 113 wxTEXT_BOX_ATTR_POSITION_MASK 114}; 115 116enum wxTextAttrBorderStyle 117{ 118 wxTEXT_BOX_ATTR_BORDER_NONE, 119 wxTEXT_BOX_ATTR_BORDER_SOLID, 120 wxTEXT_BOX_ATTR_BORDER_DOTTED, 121 wxTEXT_BOX_ATTR_BORDER_DASHED, 122 wxTEXT_BOX_ATTR_BORDER_DOUBLE, 123 wxTEXT_BOX_ATTR_BORDER_GROOVE, 124 wxTEXT_BOX_ATTR_BORDER_RIDGE, 125 wxTEXT_BOX_ATTR_BORDER_INSET, 126 wxTEXT_BOX_ATTR_BORDER_OUTSET 127}; 128 129enum wxTextAttrBorderFlags 130{ 131 wxTEXT_BOX_ATTR_BORDER_STYLE, 132 wxTEXT_BOX_ATTR_BORDER_COLOUR 133}; 134 135enum wxTextAttrBorderWidth 136{ 137 wxTEXT_BOX_ATTR_BORDER_THIN, 138 wxTEXT_BOX_ATTR_BORDER_MEDIUM, 139 wxTEXT_BOX_ATTR_BORDER_THICK 140}; 141 142enum wxTextBoxAttrFloatStyle 143{ 144 wxTEXT_BOX_ATTR_FLOAT_NONE, 145 wxTEXT_BOX_ATTR_FLOAT_LEFT, 146 wxTEXT_BOX_ATTR_FLOAT_RIGHT 147}; 148 149enum wxTextBoxAttrClearStyle 150{ 151 wxTEXT_BOX_ATTR_CLEAR_NONE, 152 wxTEXT_BOX_ATTR_CLEAR_LEFT, 153 wxTEXT_BOX_ATTR_CLEAR_RIGHT, 154 wxTEXT_BOX_ATTR_CLEAR_BOTH 155}; 156 157enum wxTextBoxAttrCollapseMode 158{ 159 wxTEXT_BOX_ATTR_COLLAPSE_NONE, 160 wxTEXT_BOX_ATTR_COLLAPSE_FULL 161}; 162 163enum wxTextBoxAttrVerticalAlignment 164{ 165 wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE, 166 wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP, 167 wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE, 168 wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM 169}; 170 171enum wxRichTextCommandId 172{ 173 wxRICHTEXT_INSERT, 174 wxRICHTEXT_DELETE, 175 wxRICHTEXT_CHANGE_ATTRIBUTES, 176 wxRICHTEXT_CHANGE_STYLE, 177 wxRICHTEXT_CHANGE_OBJECT 178}; 179 180typedef unsigned short wxTextAttrDimensionFlags; 181 182const wxChar wxRichTextLineBreakChar; 183 184class wxTextAttrDimension 185{ 186 %Docstring 187 TextAttrDimension() 188 TextAttrDimension(value, units=TEXT_ATTR_UNITS_TENTHS_MM) 189 190 A class representing a rich text dimension, including units and 191 position. 192 %End 193 %TypeHeaderCode 194 #include <wx/richtext/richtextbuffer.h> 195 %End 196 197public: 198 wxTextAttrDimension(); 199 200 wxTextAttrDimension( 201 int value, 202 wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM 203 ); 204 205 int m_value; 206 207 wxTextAttrDimensionFlags m_flags; 208 209 void Reset(); 210 %Docstring 211 Reset() 212 213 Resets the dimension value and flags. 214 %End 215 216 bool EqPartial( 217 const wxTextAttrDimension & dim, 218 bool weakTest = true 219 ) const; 220 %Docstring 221 EqPartial(dim, weakTest=True) -> bool 222 223 Partial equality test. 224 %End 225 226 bool Apply( 227 const wxTextAttrDimension & dim, 228 const wxTextAttrDimension * compareWith = NULL 229 ); 230 %Docstring 231 Apply(dim, compareWith=None) -> bool 232 233 Apply the dimension, but not those identical to compareWith if 234 present. 235 %End 236 237 void CollectCommonAttributes( 238 const wxTextAttrDimension & attr, 239 wxTextAttrDimension & clashingAttr, 240 wxTextAttrDimension & absentAttr 241 ); 242 %Docstring 243 CollectCommonAttributes(attr, clashingAttr, absentAttr) 244 245 Collects the attributes that are common to a range of content, 246 building up a note of which attributes are absent in some objects and 247 which clash in some objects. 248 %End 249 250 bool operator==( 251 const wxTextAttrDimension & dim 252 ) const; 253 254 int GetValue() const; 255 %Docstring 256 GetValue() -> int 257 258 Returns the integer value of the dimension. 259 %End 260 261 float GetValueMM() const; 262 %Docstring 263 GetValueMM() -> float 264 265 Returns the floating-pointing value of the dimension in mm. 266 %End 267 268 void SetValueMM( 269 float value 270 ); 271 %Docstring 272 SetValueMM(value) 273 274 Sets the value of the dimension in mm. 275 %End 276 277 void SetValue( 278 int value 279 ); 280 %Docstring 281 SetValue(value) 282 SetValue(value, flags) 283 SetValue(dim) 284 285 Sets the integer value of the dimension. 286 %End 287 288 void SetValue( 289 int value, 290 wxTextAttrDimensionFlags flags 291 ); 292 293 void SetValue( 294 const wxTextAttrDimension & dim 295 ); 296 297 wxTextAttrUnits GetUnits() const; 298 %Docstring 299 GetUnits() -> TextAttrUnits 300 301 Gets the units of the dimension. 302 %End 303 304 void SetUnits( 305 wxTextAttrUnits units 306 ); 307 %Docstring 308 SetUnits(units) 309 310 Sets the units of the dimension. 311 %End 312 313 wxTextBoxAttrPosition GetPosition() const; 314 %Docstring 315 GetPosition() -> TextBoxAttrPosition 316 317 Gets the position flags. 318 %End 319 320 void SetPosition( 321 wxTextBoxAttrPosition pos 322 ); 323 %Docstring 324 SetPosition(pos) 325 326 Sets the position flags. 327 %End 328 329 bool IsValid() const; 330 %Docstring 331 IsValid() -> bool 332 333 Returns true if the dimension is valid. 334 %End 335 336 void SetValid( 337 bool b 338 ); 339 %Docstring 340 SetValid(b) 341 342 Sets the valid flag. 343 %End 344 345 wxTextAttrDimensionFlags GetFlags() const; 346 %Docstring 347 GetFlags() -> TextAttrDimensionFlags 348 349 Gets the dimension flags. 350 %End 351 352 void SetFlags( 353 wxTextAttrDimensionFlags flags 354 ); 355 %Docstring 356 SetFlags(flags) 357 358 Sets the dimension flags. 359 %End 360 361 int __nonzero__(); 362 %Docstring 363 __nonzero__() -> int 364 %End 365 %MethodCode 366 PyErr_Clear(); 367 Py_BEGIN_ALLOW_THREADS 368 sipRes = _wxTextAttrDimension___nonzero__(sipCpp); 369 Py_END_ALLOW_THREADS 370 if (PyErr_Occurred()) sipIsErr = 1; 371 %End 372 %TypeCode 373 int _wxTextAttrDimension___nonzero__(wxTextAttrDimension* self) 374 { 375 return self->IsValid(); 376 } 377 %End 378 379 int __bool__(); 380 %Docstring 381 __bool__() -> int 382 %End 383 %MethodCode 384 PyErr_Clear(); 385 Py_BEGIN_ALLOW_THREADS 386 sipRes = _wxTextAttrDimension___bool__(sipCpp); 387 Py_END_ALLOW_THREADS 388 if (PyErr_Occurred()) sipIsErr = 1; 389 %End 390 %TypeCode 391 int _wxTextAttrDimension___bool__(wxTextAttrDimension* self) 392 { 393 return self->IsValid(); 394 } 395 %End 396 397 public: 398 399 400 %Property(name=Flags, get=GetFlags, set=SetFlags) 401 %Property(name=Position, get=GetPosition, set=SetPosition) 402 %Property(name=Units, get=GetUnits, set=SetUnits) 403 %Property(name=Value, get=GetValue, set=SetValue) 404 %Property(name=ValueMM, get=GetValueMM, set=SetValueMM) 405}; // end of class wxTextAttrDimension 406 407 408class wxTextAttrDimensions 409{ 410 %Docstring 411 TextAttrDimensions() 412 413 A class for left, right, top and bottom dimensions. 414 %End 415 %TypeHeaderCode 416 #include <wx/richtext/richtextbuffer.h> 417 %End 418 419public: 420 wxTextAttrDimensions(); 421 422 wxTextAttrDimension m_left; 423 424 wxTextAttrDimension m_top; 425 426 wxTextAttrDimension m_right; 427 428 wxTextAttrDimension m_bottom; 429 430 void Reset(); 431 %Docstring 432 Reset() 433 434 Resets the value and flags for all dimensions. 435 %End 436 437 bool operator==( 438 const wxTextAttrDimensions & dims 439 ) const; 440 441 bool EqPartial( 442 const wxTextAttrDimensions & dims, 443 bool weakTest = true 444 ) const; 445 %Docstring 446 EqPartial(dims, weakTest=True) -> bool 447 448 Partial equality test. 449 %End 450 451 bool Apply( 452 const wxTextAttrDimensions & dims, 453 const wxTextAttrDimensions * compareWith = NULL 454 ); 455 %Docstring 456 Apply(dims, compareWith=None) -> bool 457 458 Apply to 'this', but not if the same as compareWith. 459 %End 460 461 void CollectCommonAttributes( 462 const wxTextAttrDimensions & attr, 463 wxTextAttrDimensions & clashingAttr, 464 wxTextAttrDimensions & absentAttr 465 ); 466 %Docstring 467 CollectCommonAttributes(attr, clashingAttr, absentAttr) 468 469 Collects the attributes that are common to a range of content, 470 building up a note of which attributes are absent in some objects and 471 which clash in some objects. 472 %End 473 474 bool RemoveStyle( 475 const wxTextAttrDimensions & attr 476 ); 477 %Docstring 478 RemoveStyle(attr) -> bool 479 480 Remove specified attributes from this object. 481 %End 482 483 wxTextAttrDimension & GetLeft(); 484 %Docstring 485 GetLeft() -> TextAttrDimension 486 %End 487 488 wxTextAttrDimension & GetRight(); 489 %Docstring 490 GetRight() -> TextAttrDimension 491 %End 492 493 wxTextAttrDimension & GetTop(); 494 %Docstring 495 GetTop() -> TextAttrDimension 496 %End 497 498 wxTextAttrDimension & GetBottom(); 499 %Docstring 500 GetBottom() -> TextAttrDimension 501 %End 502 503 bool IsValid() const; 504 %Docstring 505 IsValid() -> bool 506 507 Are all dimensions valid? 508 %End 509 510 int __nonzero__(); 511 %Docstring 512 __nonzero__() -> int 513 %End 514 %MethodCode 515 PyErr_Clear(); 516 Py_BEGIN_ALLOW_THREADS 517 sipRes = _wxTextAttrDimensions___nonzero__(sipCpp); 518 Py_END_ALLOW_THREADS 519 if (PyErr_Occurred()) sipIsErr = 1; 520 %End 521 %TypeCode 522 int _wxTextAttrDimensions___nonzero__(wxTextAttrDimensions* self) 523 { 524 return self->IsValid(); 525 } 526 %End 527 528 int __bool__(); 529 %Docstring 530 __bool__() -> int 531 %End 532 %MethodCode 533 PyErr_Clear(); 534 Py_BEGIN_ALLOW_THREADS 535 sipRes = _wxTextAttrDimensions___bool__(sipCpp); 536 Py_END_ALLOW_THREADS 537 if (PyErr_Occurred()) sipIsErr = 1; 538 %End 539 %TypeCode 540 int _wxTextAttrDimensions___bool__(wxTextAttrDimensions* self) 541 { 542 return self->IsValid(); 543 } 544 %End 545 546 public: 547 548 549 %Property(name=Bottom, get=GetBottom) 550 %Property(name=Left, get=GetLeft) 551 %Property(name=Right, get=GetRight) 552 %Property(name=Top, get=GetTop) 553}; // end of class wxTextAttrDimensions 554 555 556class wxTextAttrSize 557{ 558 %Docstring 559 TextAttrSize() 560 561 A class for representing width and height. 562 %End 563 %TypeHeaderCode 564 #include <wx/richtext/richtextbuffer.h> 565 %End 566 567public: 568 wxTextAttrSize(); 569 570 wxTextAttrDimension m_width; 571 572 wxTextAttrDimension m_height; 573 574 void Reset(); 575 %Docstring 576 Reset() 577 578 Resets the width and height dimensions. 579 %End 580 581 bool operator==( 582 const wxTextAttrSize & size 583 ) const; 584 585 bool EqPartial( 586 const wxTextAttrSize & size, 587 bool weakTest = true 588 ) const; 589 %Docstring 590 EqPartial(size, weakTest=True) -> bool 591 592 Partial equality test. 593 %End 594 595 bool Apply( 596 const wxTextAttrSize & dims, 597 const wxTextAttrSize * compareWith = NULL 598 ); 599 %Docstring 600 Apply(dims, compareWith=None) -> bool 601 602 Apply to this object, but not if the same as compareWith. 603 %End 604 605 void CollectCommonAttributes( 606 const wxTextAttrSize & attr, 607 wxTextAttrSize & clashingAttr, 608 wxTextAttrSize & absentAttr 609 ); 610 %Docstring 611 CollectCommonAttributes(attr, clashingAttr, absentAttr) 612 613 Collects the attributes that are common to a range of content, 614 building up a note of which attributes are absent in some objects and 615 which clash in some objects. 616 %End 617 618 bool RemoveStyle( 619 const wxTextAttrSize & attr 620 ); 621 %Docstring 622 RemoveStyle(attr) -> bool 623 624 Removes the specified attributes from this object. 625 %End 626 627 wxTextAttrDimension & GetWidth(); 628 %Docstring 629 GetWidth() -> TextAttrDimension 630 631 Returns the width. 632 %End 633 634 void SetWidth( 635 int value, 636 wxTextAttrDimensionFlags flags 637 ); 638 %Docstring 639 SetWidth(value, flags) 640 SetWidth(dim) 641 642 Sets the width. 643 %End 644 645 void SetWidth( 646 const wxTextAttrDimension & dim 647 ); 648 649 wxTextAttrDimension & GetHeight(); 650 %Docstring 651 GetHeight() -> TextAttrDimension 652 653 Gets the height. 654 %End 655 656 void SetHeight( 657 int value, 658 wxTextAttrDimensionFlags flags 659 ); 660 %Docstring 661 SetHeight(value, flags) 662 SetHeight(dim) 663 664 Sets the height. 665 %End 666 667 void SetHeight( 668 const wxTextAttrDimension & dim 669 ); 670 671 bool IsValid() const; 672 %Docstring 673 IsValid() -> bool 674 675 Is the size valid? 676 %End 677 678 int __nonzero__(); 679 %Docstring 680 __nonzero__() -> int 681 %End 682 %MethodCode 683 PyErr_Clear(); 684 Py_BEGIN_ALLOW_THREADS 685 sipRes = _wxTextAttrSize___nonzero__(sipCpp); 686 Py_END_ALLOW_THREADS 687 if (PyErr_Occurred()) sipIsErr = 1; 688 %End 689 %TypeCode 690 int _wxTextAttrSize___nonzero__(wxTextAttrSize* self) 691 { 692 return self->IsValid(); 693 } 694 %End 695 696 int __bool__(); 697 %Docstring 698 __bool__() -> int 699 %End 700 %MethodCode 701 PyErr_Clear(); 702 Py_BEGIN_ALLOW_THREADS 703 sipRes = _wxTextAttrSize___bool__(sipCpp); 704 Py_END_ALLOW_THREADS 705 if (PyErr_Occurred()) sipIsErr = 1; 706 %End 707 %TypeCode 708 int _wxTextAttrSize___bool__(wxTextAttrSize* self) 709 { 710 return self->IsValid(); 711 } 712 %End 713 714 public: 715 716 717 %Property(name=Height, get=GetHeight, set=SetHeight) 718 %Property(name=Width, get=GetWidth, set=SetWidth) 719}; // end of class wxTextAttrSize 720 721 722class wxTextAttrDimensionConverter 723{ 724 %Docstring 725 TextAttrDimensionConverter(dc, scale=1.0, parentSize=wx.DefaultSize) 726 TextAttrDimensionConverter(ppi, scale=1.0, parentSize=wx.DefaultSize) 727 728 A class to make it easier to convert dimensions. 729 %End 730 %TypeHeaderCode 731 #include <wx/richtext/richtextbuffer.h> 732 %End 733 734public: 735 wxTextAttrDimensionConverter( 736 wxDC & dc, 737 double scale = 1.0, 738 const wxSize & parentSize = wxDefaultSize 739 ); 740 741 wxTextAttrDimensionConverter( 742 int ppi, 743 double scale = 1.0, 744 const wxSize & parentSize = wxDefaultSize 745 ); 746 747 int m_ppi; 748 749 double m_scale; 750 751 wxSize m_parentSize; 752 753 int GetPixels( 754 const wxTextAttrDimension & dim, 755 int direction = wxHORIZONTAL 756 ) const; 757 %Docstring 758 GetPixels(dim, direction=wx.HORIZONTAL) -> int 759 760 Gets the pixel size for the given dimension. 761 %End 762 763 int GetTenthsMM( 764 const wxTextAttrDimension & dim 765 ) const; 766 %Docstring 767 GetTenthsMM(dim) -> int 768 769 Gets the mm size for the given dimension. 770 %End 771 772 int ConvertTenthsMMToPixels( 773 int units 774 ) const; 775 %Docstring 776 ConvertTenthsMMToPixels(units) -> int 777 778 Converts tenths of a mm to pixels. 779 %End 780 781 int ConvertPixelsToTenthsMM( 782 int pixels 783 ) const; 784 %Docstring 785 ConvertPixelsToTenthsMM(pixels) -> int 786 787 Converts pixels to tenths of a mm. 788 %End 789 790}; // end of class wxTextAttrDimensionConverter 791 792 793class wxTextAttrBorder 794{ 795 %Docstring 796 TextAttrBorder() 797 798 A class representing a rich text object border. 799 %End 800 %TypeHeaderCode 801 #include <wx/richtext/richtextbuffer.h> 802 %End 803 804public: 805 wxTextAttrBorder(); 806 807 int m_borderStyle; 808 809 unsigned long m_borderColour; 810 811 wxTextAttrDimension m_borderWidth; 812 813 int m_flags; 814 815 bool operator==( 816 const wxTextAttrBorder & border 817 ) const; 818 819 void Reset(); 820 %Docstring 821 Reset() 822 823 Resets the border style, colour, width and flags. 824 %End 825 826 bool EqPartial( 827 const wxTextAttrBorder & border, 828 bool weakTest = true 829 ) const; 830 %Docstring 831 EqPartial(border, weakTest=True) -> bool 832 833 Partial equality test. 834 %End 835 836 bool Apply( 837 const wxTextAttrBorder & border, 838 const wxTextAttrBorder * compareWith = NULL 839 ); 840 %Docstring 841 Apply(border, compareWith=None) -> bool 842 843 Applies the border to this object, but not if the same as compareWith. 844 %End 845 846 bool RemoveStyle( 847 const wxTextAttrBorder & attr 848 ); 849 %Docstring 850 RemoveStyle(attr) -> bool 851 852 Removes the specified attributes from this object. 853 %End 854 855 void CollectCommonAttributes( 856 const wxTextAttrBorder & attr, 857 wxTextAttrBorder & clashingAttr, 858 wxTextAttrBorder & absentAttr 859 ); 860 %Docstring 861 CollectCommonAttributes(attr, clashingAttr, absentAttr) 862 863 Collects the attributes that are common to a range of content, 864 building up a note of which attributes are absent in some objects and 865 which clash in some objects. 866 %End 867 868 void SetStyle( 869 int style 870 ); 871 %Docstring 872 SetStyle(style) 873 874 Sets the border style. 875 %End 876 877 int GetStyle() const; 878 %Docstring 879 GetStyle() -> int 880 881 Gets the border style. 882 %End 883 884 void SetColour( 885 unsigned long colour 886 ); 887 %Docstring 888 SetColour(colour) 889 SetColour(colour) 890 891 Sets the border colour. 892 %End 893 894 void SetColour( 895 const wxColour & colour 896 ); 897 898 unsigned long GetColourLong() const; 899 %Docstring 900 GetColourLong() -> unsignedlong 901 902 Gets the colour as a long. 903 %End 904 905 wxColour GetColour() const; 906 %Docstring 907 GetColour() -> wx.Colour 908 909 Gets the colour. 910 %End 911 912 wxTextAttrDimension & GetWidth(); 913 %Docstring 914 GetWidth() -> TextAttrDimension 915 916 Gets the border width. 917 %End 918 919 void SetWidth( 920 const wxTextAttrDimension & width 921 ); 922 %Docstring 923 SetWidth(width) 924 SetWidth(value, units=TEXT_ATTR_UNITS_TENTHS_MM) 925 926 Sets the border width. 927 %End 928 929 void SetWidth( 930 int value, 931 wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM 932 ); 933 934 bool HasStyle() const; 935 %Docstring 936 HasStyle() -> bool 937 938 True if the border has a valid style. 939 %End 940 941 bool HasColour() const; 942 %Docstring 943 HasColour() -> bool 944 945 True if the border has a valid colour. 946 %End 947 948 bool HasWidth() const; 949 %Docstring 950 HasWidth() -> bool 951 952 True if the border has a valid width. 953 %End 954 955 bool IsValid() const; 956 %Docstring 957 IsValid() -> bool 958 959 True if the border is valid. 960 %End 961 962 bool IsDefault() const; 963 %Docstring 964 IsDefault() -> bool 965 966 True if the border has no attributes set. 967 %End 968 969 void MakeValid(); 970 %Docstring 971 MakeValid() 972 973 Set the valid flag for this border. 974 %End 975 976 int GetFlags() const; 977 %Docstring 978 GetFlags() -> int 979 980 Returns the border flags. 981 %End 982 983 void SetFlags( 984 int flags 985 ); 986 %Docstring 987 SetFlags(flags) 988 989 Sets the border flags. 990 %End 991 992 void AddFlag( 993 int flag 994 ); 995 %Docstring 996 AddFlag(flag) 997 998 Adds a border flag. 999 %End 1000 1001 void RemoveFlag( 1002 int flag 1003 ); 1004 %Docstring 1005 RemoveFlag(flag) 1006 1007 Removes a border flag. 1008 %End 1009 1010 int __nonzero__(); 1011 %Docstring 1012 __nonzero__() -> int 1013 %End 1014 %MethodCode 1015 PyErr_Clear(); 1016 Py_BEGIN_ALLOW_THREADS 1017 sipRes = _wxTextAttrBorder___nonzero__(sipCpp); 1018 Py_END_ALLOW_THREADS 1019 if (PyErr_Occurred()) sipIsErr = 1; 1020 %End 1021 %TypeCode 1022 int _wxTextAttrBorder___nonzero__(wxTextAttrBorder* self) 1023 { 1024 return self->IsValid(); 1025 } 1026 %End 1027 1028 int __bool__(); 1029 %Docstring 1030 __bool__() -> int 1031 %End 1032 %MethodCode 1033 PyErr_Clear(); 1034 Py_BEGIN_ALLOW_THREADS 1035 sipRes = _wxTextAttrBorder___bool__(sipCpp); 1036 Py_END_ALLOW_THREADS 1037 if (PyErr_Occurred()) sipIsErr = 1; 1038 %End 1039 %TypeCode 1040 int _wxTextAttrBorder___bool__(wxTextAttrBorder* self) 1041 { 1042 return self->IsValid(); 1043 } 1044 %End 1045 1046 public: 1047 1048 1049 %Property(name=Colour, get=GetColour, set=SetColour) 1050 %Property(name=ColourLong, get=GetColourLong) 1051 %Property(name=Flags, get=GetFlags, set=SetFlags) 1052 %Property(name=Style, get=GetStyle, set=SetStyle) 1053 %Property(name=Width, get=GetWidth, set=SetWidth) 1054}; // end of class wxTextAttrBorder 1055 1056 1057class wxTextAttrBorders 1058{ 1059 %Docstring 1060 TextAttrBorders() 1061 1062 A class representing a rich text object's borders. 1063 %End 1064 %TypeHeaderCode 1065 #include <wx/richtext/richtextbuffer.h> 1066 %End 1067 1068public: 1069 wxTextAttrBorders(); 1070 1071 wxTextAttrBorder m_left; 1072 1073 wxTextAttrBorder m_right; 1074 1075 wxTextAttrBorder m_top; 1076 1077 wxTextAttrBorder m_bottom; 1078 1079 bool operator==( 1080 const wxTextAttrBorders & borders 1081 ) const; 1082 1083 void SetStyle( 1084 int style 1085 ); 1086 %Docstring 1087 SetStyle(style) 1088 1089 Sets the style of all borders. 1090 %End 1091 1092 void SetColour( 1093 unsigned long colour 1094 ); 1095 %Docstring 1096 SetColour(colour) 1097 SetColour(colour) 1098 1099 Sets colour of all borders. 1100 %End 1101 1102 void SetColour( 1103 const wxColour & colour 1104 ); 1105 1106 void SetWidth( 1107 const wxTextAttrDimension & width 1108 ); 1109 %Docstring 1110 SetWidth(width) 1111 SetWidth(value, units=TEXT_ATTR_UNITS_TENTHS_MM) 1112 1113 Sets the width of all borders. 1114 %End 1115 1116 void SetWidth( 1117 int value, 1118 wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM 1119 ); 1120 1121 void Reset(); 1122 %Docstring 1123 Reset() 1124 1125 Resets all borders. 1126 %End 1127 1128 bool EqPartial( 1129 const wxTextAttrBorders & borders, 1130 bool weakTest = true 1131 ) const; 1132 %Docstring 1133 EqPartial(borders, weakTest=True) -> bool 1134 1135 Partial equality test. 1136 %End 1137 1138 bool Apply( 1139 const wxTextAttrBorders & borders, 1140 const wxTextAttrBorders * compareWith = NULL 1141 ); 1142 %Docstring 1143 Apply(borders, compareWith=None) -> bool 1144 1145 Applies border to this object, but not if the same as compareWith. 1146 %End 1147 1148 bool RemoveStyle( 1149 const wxTextAttrBorders & attr 1150 ); 1151 %Docstring 1152 RemoveStyle(attr) -> bool 1153 1154 Removes the specified attributes from this object. 1155 %End 1156 1157 void CollectCommonAttributes( 1158 const wxTextAttrBorders & attr, 1159 wxTextAttrBorders & clashingAttr, 1160 wxTextAttrBorders & absentAttr 1161 ); 1162 %Docstring 1163 CollectCommonAttributes(attr, clashingAttr, absentAttr) 1164 1165 Collects the attributes that are common to a range of content, 1166 building up a note of which attributes are absent in some objects and 1167 which clash in some objects. 1168 %End 1169 1170 bool IsValid() const; 1171 %Docstring 1172 IsValid() -> bool 1173 1174 Returns true if at least one border is valid. 1175 %End 1176 1177 wxTextAttrBorder & GetLeft(); 1178 %Docstring 1179 GetLeft() -> TextAttrBorder 1180 %End 1181 1182 wxTextAttrBorder & GetRight(); 1183 %Docstring 1184 GetRight() -> TextAttrBorder 1185 %End 1186 1187 wxTextAttrBorder & GetTop(); 1188 %Docstring 1189 GetTop() -> TextAttrBorder 1190 %End 1191 1192 wxTextAttrBorder & GetBottom(); 1193 %Docstring 1194 GetBottom() -> TextAttrBorder 1195 %End 1196 1197 int __nonzero__(); 1198 %Docstring 1199 __nonzero__() -> int 1200 %End 1201 %MethodCode 1202 PyErr_Clear(); 1203 Py_BEGIN_ALLOW_THREADS 1204 sipRes = _wxTextAttrBorders___nonzero__(sipCpp); 1205 Py_END_ALLOW_THREADS 1206 if (PyErr_Occurred()) sipIsErr = 1; 1207 %End 1208 %TypeCode 1209 int _wxTextAttrBorders___nonzero__(wxTextAttrBorders* self) 1210 { 1211 return self->IsValid(); 1212 } 1213 %End 1214 1215 int __bool__(); 1216 %Docstring 1217 __bool__() -> int 1218 %End 1219 %MethodCode 1220 PyErr_Clear(); 1221 Py_BEGIN_ALLOW_THREADS 1222 sipRes = _wxTextAttrBorders___bool__(sipCpp); 1223 Py_END_ALLOW_THREADS 1224 if (PyErr_Occurred()) sipIsErr = 1; 1225 %End 1226 %TypeCode 1227 int _wxTextAttrBorders___bool__(wxTextAttrBorders* self) 1228 { 1229 return self->IsValid(); 1230 } 1231 %End 1232 1233 public: 1234 1235 1236 %Property(name=Bottom, get=GetBottom) 1237 %Property(name=Left, get=GetLeft) 1238 %Property(name=Right, get=GetRight) 1239 %Property(name=Top, get=GetTop) 1240}; // end of class wxTextAttrBorders 1241 1242 1243class wxTextBoxAttr 1244{ 1245 %Docstring 1246 TextBoxAttr() 1247 TextBoxAttr(attr) 1248 1249 A class representing the box attributes of a rich text object. 1250 %End 1251 %TypeHeaderCode 1252 #include <wx/richtext/richtextbuffer.h> 1253 %End 1254 1255public: 1256 wxTextBoxAttr(); 1257 1258 wxTextBoxAttr( 1259 const wxTextBoxAttr & attr 1260 ); 1261 1262 int m_flags; 1263 1264 wxTextAttrDimensions m_margins; 1265 1266 wxTextAttrDimensions m_padding; 1267 1268 wxTextAttrDimensions m_position; 1269 1270 wxTextAttrSize m_size; 1271 1272 wxTextAttrSize m_minSize; 1273 1274 wxTextAttrSize m_maxSize; 1275 1276 wxTextAttrBorders m_border; 1277 1278 wxTextAttrBorders m_outline; 1279 1280 wxTextBoxAttrFloatStyle m_floatMode; 1281 1282 wxTextBoxAttrClearStyle m_clearMode; 1283 1284 wxTextBoxAttrCollapseMode m_collapseMode; 1285 1286 wxTextBoxAttrVerticalAlignment m_verticalAlignment; 1287 1288 wxString m_boxStyleName; 1289 1290 void Init(); 1291 %Docstring 1292 Init() 1293 1294 Initialises this object. 1295 %End 1296 1297 void Reset(); 1298 %Docstring 1299 Reset() 1300 1301 Resets this object. 1302 %End 1303 1304 bool operator==( 1305 const wxTextBoxAttr & attr 1306 ) const; 1307 1308 bool EqPartial( 1309 const wxTextBoxAttr & attr, 1310 bool weakTest = true 1311 ) const; 1312 %Docstring 1313 EqPartial(attr, weakTest=True) -> bool 1314 1315 Partial equality test, ignoring unset attributes. 1316 %End 1317 1318 bool Apply( 1319 const wxTextBoxAttr & style, 1320 const wxTextBoxAttr * compareWith = NULL 1321 ); 1322 %Docstring 1323 Apply(style, compareWith=None) -> bool 1324 1325 Merges the given attributes. 1326 %End 1327 1328 void CollectCommonAttributes( 1329 const wxTextBoxAttr & attr, 1330 wxTextBoxAttr & clashingAttr, 1331 wxTextBoxAttr & absentAttr 1332 ); 1333 %Docstring 1334 CollectCommonAttributes(attr, clashingAttr, absentAttr) 1335 1336 Collects the attributes that are common to a range of content, 1337 building up a note of which attributes are absent in some objects and 1338 which clash in some objects. 1339 %End 1340 1341 bool RemoveStyle( 1342 const wxTextBoxAttr & attr 1343 ); 1344 %Docstring 1345 RemoveStyle(attr) -> bool 1346 1347 Removes the specified attributes from this object. 1348 %End 1349 1350 void SetFlags( 1351 int flags 1352 ); 1353 %Docstring 1354 SetFlags(flags) 1355 1356 Sets the flags. 1357 %End 1358 1359 int GetFlags() const; 1360 %Docstring 1361 GetFlags() -> int 1362 1363 Returns the flags. 1364 %End 1365 1366 bool HasFlag( 1367 wxTextBoxAttrFlags flag 1368 ) const; 1369 %Docstring 1370 HasFlag(flag) -> bool 1371 1372 Is this flag present? 1373 %End 1374 1375 void RemoveFlag( 1376 wxTextBoxAttrFlags flag 1377 ); 1378 %Docstring 1379 RemoveFlag(flag) 1380 1381 Removes this flag. 1382 %End 1383 1384 void AddFlag( 1385 wxTextBoxAttrFlags flag 1386 ); 1387 %Docstring 1388 AddFlag(flag) 1389 1390 Adds this flag. 1391 %End 1392 1393 bool IsDefault() const; 1394 %Docstring 1395 IsDefault() -> bool 1396 1397 Returns true if no attributes are set. 1398 %End 1399 1400 wxTextBoxAttrFloatStyle GetFloatMode() const; 1401 %Docstring 1402 GetFloatMode() -> TextBoxAttrFloatStyle 1403 1404 Returns the float mode. 1405 %End 1406 1407 void SetFloatMode( 1408 wxTextBoxAttrFloatStyle mode 1409 ); 1410 %Docstring 1411 SetFloatMode(mode) 1412 1413 Sets the float mode. 1414 %End 1415 1416 bool HasFloatMode() const; 1417 %Docstring 1418 HasFloatMode() -> bool 1419 1420 Returns true if float mode is active. 1421 %End 1422 1423 bool IsFloating() const; 1424 %Docstring 1425 IsFloating() -> bool 1426 1427 Returns true if this object is floating. 1428 %End 1429 1430 wxTextBoxAttrClearStyle GetClearMode() const; 1431 %Docstring 1432 GetClearMode() -> TextBoxAttrClearStyle 1433 1434 Returns the clear mode - whether to wrap text after object. 1435 %End 1436 1437 void SetClearMode( 1438 wxTextBoxAttrClearStyle mode 1439 ); 1440 %Docstring 1441 SetClearMode(mode) 1442 1443 Set the clear mode. 1444 %End 1445 1446 bool HasClearMode() const; 1447 %Docstring 1448 HasClearMode() -> bool 1449 1450 Returns true if we have a clear flag. 1451 %End 1452 1453 wxTextBoxAttrCollapseMode GetCollapseBorders() const; 1454 %Docstring 1455 GetCollapseBorders() -> TextBoxAttrCollapseMode 1456 1457 Returns the collapse mode - whether to collapse borders. 1458 %End 1459 1460 void SetCollapseBorders( 1461 wxTextBoxAttrCollapseMode collapse 1462 ); 1463 %Docstring 1464 SetCollapseBorders(collapse) 1465 1466 Sets the collapse mode - whether to collapse borders. 1467 %End 1468 1469 bool HasCollapseBorders() const; 1470 %Docstring 1471 HasCollapseBorders() -> bool 1472 1473 Returns true if the collapse borders flag is present. 1474 %End 1475 1476 wxTextBoxAttrVerticalAlignment GetVerticalAlignment() const; 1477 %Docstring 1478 GetVerticalAlignment() -> TextBoxAttrVerticalAlignment 1479 1480 Returns the vertical alignment. 1481 %End 1482 1483 void SetVerticalAlignment( 1484 wxTextBoxAttrVerticalAlignment verticalAlignment 1485 ); 1486 %Docstring 1487 SetVerticalAlignment(verticalAlignment) 1488 1489 Sets the vertical alignment. 1490 %End 1491 1492 bool HasVerticalAlignment() const; 1493 %Docstring 1494 HasVerticalAlignment() -> bool 1495 1496 Returns true if a vertical alignment flag is present. 1497 %End 1498 1499 wxTextAttrDimensions & GetMargins(); 1500 %Docstring 1501 GetMargins() -> TextAttrDimensions 1502 1503 Returns the margin values. 1504 %End 1505 1506 wxTextAttrDimension & GetLeftMargin(); 1507 %Docstring 1508 GetLeftMargin() -> TextAttrDimension 1509 1510 Returns the left margin. 1511 %End 1512 1513 wxTextAttrDimension & GetRightMargin(); 1514 %Docstring 1515 GetRightMargin() -> TextAttrDimension 1516 1517 Returns the right margin. 1518 %End 1519 1520 wxTextAttrDimension & GetTopMargin(); 1521 %Docstring 1522 GetTopMargin() -> TextAttrDimension 1523 1524 Returns the top margin. 1525 %End 1526 1527 wxTextAttrDimension & GetBottomMargin(); 1528 %Docstring 1529 GetBottomMargin() -> TextAttrDimension 1530 1531 Returns the bottom margin. 1532 %End 1533 1534 wxTextAttrDimensions & GetPosition(); 1535 %Docstring 1536 GetPosition() -> TextAttrDimensions 1537 1538 Returns the position. 1539 %End 1540 1541 wxTextAttrDimension & GetLeft(); 1542 %Docstring 1543 GetLeft() -> TextAttrDimension 1544 1545 Returns the left position. 1546 %End 1547 1548 wxTextAttrDimension & GetRight(); 1549 %Docstring 1550 GetRight() -> TextAttrDimension 1551 1552 Returns the right position. 1553 %End 1554 1555 wxTextAttrDimension & GetTop(); 1556 %Docstring 1557 GetTop() -> TextAttrDimension 1558 1559 Returns the top position. 1560 %End 1561 1562 wxTextAttrDimension & GetBottom(); 1563 %Docstring 1564 GetBottom() -> TextAttrDimension 1565 1566 Returns the bottom position. 1567 %End 1568 1569 wxTextAttrDimensions & GetPadding(); 1570 %Docstring 1571 GetPadding() -> TextAttrDimensions 1572 1573 Returns the padding values. 1574 %End 1575 1576 wxTextAttrDimension & GetLeftPadding(); 1577 %Docstring 1578 GetLeftPadding() -> TextAttrDimension 1579 1580 Returns the left padding value. 1581 %End 1582 1583 wxTextAttrDimension & GetRightPadding(); 1584 %Docstring 1585 GetRightPadding() -> TextAttrDimension 1586 1587 Returns the right padding value. 1588 %End 1589 1590 wxTextAttrDimension & GetTopPadding(); 1591 %Docstring 1592 GetTopPadding() -> TextAttrDimension 1593 1594 Returns the top padding value. 1595 %End 1596 1597 wxTextAttrDimension & GetBottomPadding(); 1598 %Docstring 1599 GetBottomPadding() -> TextAttrDimension 1600 1601 Returns the bottom padding value. 1602 %End 1603 1604 wxTextAttrBorders & GetBorder(); 1605 %Docstring 1606 GetBorder() -> TextAttrBorders 1607 1608 Returns the borders. 1609 %End 1610 1611 wxTextAttrBorder & GetLeftBorder(); 1612 %Docstring 1613 GetLeftBorder() -> TextAttrBorder 1614 1615 Returns the left border. 1616 %End 1617 1618 wxTextAttrBorder & GetTopBorder(); 1619 %Docstring 1620 GetTopBorder() -> TextAttrBorder 1621 1622 Returns the top border. 1623 %End 1624 1625 wxTextAttrBorder & GetRightBorder(); 1626 %Docstring 1627 GetRightBorder() -> TextAttrBorder 1628 1629 Returns the right border. 1630 %End 1631 1632 wxTextAttrBorder & GetBottomBorder(); 1633 %Docstring 1634 GetBottomBorder() -> TextAttrBorder 1635 1636 Returns the bottom border. 1637 %End 1638 1639 wxTextAttrBorders & GetOutline(); 1640 %Docstring 1641 GetOutline() -> TextAttrBorders 1642 1643 Returns the outline. 1644 %End 1645 1646 wxTextAttrBorder & GetLeftOutline(); 1647 %Docstring 1648 GetLeftOutline() -> TextAttrBorder 1649 1650 Returns the left outline. 1651 %End 1652 1653 wxTextAttrBorder & GetTopOutline(); 1654 %Docstring 1655 GetTopOutline() -> TextAttrBorder 1656 1657 Returns the top outline. 1658 %End 1659 1660 wxTextAttrBorder & GetRightOutline(); 1661 %Docstring 1662 GetRightOutline() -> TextAttrBorder 1663 1664 Returns the right outline. 1665 %End 1666 1667 wxTextAttrBorder & GetBottomOutline(); 1668 %Docstring 1669 GetBottomOutline() -> TextAttrBorder 1670 1671 Returns the bottom outline. 1672 %End 1673 1674 wxTextAttrSize & GetSize(); 1675 %Docstring 1676 GetSize() -> TextAttrSize 1677 1678 Returns the object size. 1679 %End 1680 1681 wxTextAttrSize & GetMinSize(); 1682 %Docstring 1683 GetMinSize() -> TextAttrSize 1684 1685 Returns the object minimum size. 1686 %End 1687 1688 wxTextAttrSize & GetMaxSize(); 1689 %Docstring 1690 GetMaxSize() -> TextAttrSize 1691 1692 Returns the object maximum size. 1693 %End 1694 1695 void SetSize( 1696 const wxTextAttrSize & sz 1697 ); 1698 %Docstring 1699 SetSize(sz) 1700 1701 Sets the object size. 1702 %End 1703 1704 void SetMinSize( 1705 const wxTextAttrSize & sz 1706 ); 1707 %Docstring 1708 SetMinSize(sz) 1709 1710 Sets the object minimum size. 1711 %End 1712 1713 void SetMaxSize( 1714 const wxTextAttrSize & sz 1715 ); 1716 %Docstring 1717 SetMaxSize(sz) 1718 1719 Sets the object maximum size. 1720 %End 1721 1722 wxTextAttrDimension & GetWidth(); 1723 %Docstring 1724 GetWidth() -> TextAttrDimension 1725 1726 Returns the object width. 1727 %End 1728 1729 wxTextAttrDimension & GetHeight(); 1730 %Docstring 1731 GetHeight() -> TextAttrDimension 1732 1733 Returns the object height. 1734 %End 1735 1736 const wxString & GetBoxStyleName() const; 1737 %Docstring 1738 GetBoxStyleName() -> String 1739 1740 Returns the box style name. 1741 %End 1742 1743 void SetBoxStyleName( 1744 const wxString & name 1745 ); 1746 %Docstring 1747 SetBoxStyleName(name) 1748 1749 Sets the box style name. 1750 %End 1751 1752 bool HasBoxStyleName() const; 1753 %Docstring 1754 HasBoxStyleName() -> bool 1755 1756 Returns true if the box style name is present. 1757 %End 1758 1759 public: 1760 1761 1762 %Property(name=Border, get=GetBorder) 1763 %Property(name=Bottom, get=GetBottom) 1764 %Property(name=BottomBorder, get=GetBottomBorder) 1765 %Property(name=BottomMargin, get=GetBottomMargin) 1766 %Property(name=BottomOutline, get=GetBottomOutline) 1767 %Property(name=BottomPadding, get=GetBottomPadding) 1768 %Property(name=BoxStyleName, get=GetBoxStyleName, set=SetBoxStyleName) 1769 %Property(name=ClearMode, get=GetClearMode, set=SetClearMode) 1770 %Property(name=CollapseBorders, get=GetCollapseBorders, set=SetCollapseBorders) 1771 %Property(name=Flags, get=GetFlags, set=SetFlags) 1772 %Property(name=FloatMode, get=GetFloatMode, set=SetFloatMode) 1773 %Property(name=Height, get=GetHeight) 1774 %Property(name=Left, get=GetLeft) 1775 %Property(name=LeftBorder, get=GetLeftBorder) 1776 %Property(name=LeftMargin, get=GetLeftMargin) 1777 %Property(name=LeftOutline, get=GetLeftOutline) 1778 %Property(name=LeftPadding, get=GetLeftPadding) 1779 %Property(name=Margins, get=GetMargins) 1780 %Property(name=MaxSize, get=GetMaxSize, set=SetMaxSize) 1781 %Property(name=MinSize, get=GetMinSize, set=SetMinSize) 1782 %Property(name=Outline, get=GetOutline) 1783 %Property(name=Padding, get=GetPadding) 1784 %Property(name=Position, get=GetPosition) 1785 %Property(name=Right, get=GetRight) 1786 %Property(name=RightBorder, get=GetRightBorder) 1787 %Property(name=RightMargin, get=GetRightMargin) 1788 %Property(name=RightOutline, get=GetRightOutline) 1789 %Property(name=RightPadding, get=GetRightPadding) 1790 %Property(name=Size, get=GetSize, set=SetSize) 1791 %Property(name=Top, get=GetTop) 1792 %Property(name=TopBorder, get=GetTopBorder) 1793 %Property(name=TopMargin, get=GetTopMargin) 1794 %Property(name=TopOutline, get=GetTopOutline) 1795 %Property(name=TopPadding, get=GetTopPadding) 1796 %Property(name=VerticalAlignment, get=GetVerticalAlignment, set=SetVerticalAlignment) 1797 %Property(name=Width, get=GetWidth) 1798}; // end of class wxTextBoxAttr 1799 1800 1801class wxRichTextAttr : wxTextAttr 1802{ 1803 %Docstring 1804 RichTextAttr(attr) 1805 RichTextAttr(attr) 1806 RichTextAttr() 1807 1808 A class representing enhanced attributes for rich text objects. 1809 %End 1810 %TypeHeaderCode 1811 #include <wx/richtext/richtextbuffer.h> 1812 %End 1813 1814public: 1815 wxRichTextAttr( 1816 const wxTextAttr & attr 1817 ); 1818 1819 wxRichTextAttr( 1820 const wxRichTextAttr & attr 1821 ); 1822 1823 wxRichTextAttr(); 1824 1825 wxTextBoxAttr m_textBoxAttr; 1826 1827 void Copy( 1828 const wxRichTextAttr & attr 1829 ); 1830 %Docstring 1831 Copy(attr) 1832 1833 Copy function. 1834 %End 1835 1836 bool operator==( 1837 const wxRichTextAttr & attr 1838 ) const; 1839 1840 bool EqPartial( 1841 const wxRichTextAttr & attr, 1842 bool weakTest = true 1843 ) const; 1844 %Docstring 1845 EqPartial(attr, weakTest=True) -> bool 1846 1847 Partial equality test. 1848 %End 1849 1850 bool Apply( 1851 const wxRichTextAttr & style, 1852 const wxRichTextAttr * compareWith = NULL 1853 ); 1854 %Docstring 1855 Apply(style, compareWith=None) -> bool 1856 1857 Merges the given attributes. 1858 %End 1859 1860 void CollectCommonAttributes( 1861 const wxRichTextAttr & attr, 1862 wxRichTextAttr & clashingAttr, 1863 wxRichTextAttr & absentAttr 1864 ); 1865 %Docstring 1866 CollectCommonAttributes(attr, clashingAttr, absentAttr) 1867 1868 Collects the attributes that are common to a range of content, 1869 building up a note of which attributes are absent in some objects and 1870 which clash in some objects. 1871 %End 1872 1873 bool RemoveStyle( 1874 const wxRichTextAttr & attr 1875 ); 1876 %Docstring 1877 RemoveStyle(attr) -> bool 1878 1879 Removes the specified attributes from this object. 1880 %End 1881 1882 wxTextBoxAttr & GetTextBoxAttr(); 1883 %Docstring 1884 GetTextBoxAttr() -> TextBoxAttr 1885 1886 Returns the text box attributes. 1887 %End 1888 1889 void SetTextBoxAttr( 1890 const wxTextBoxAttr & attr 1891 ); 1892 %Docstring 1893 SetTextBoxAttr(attr) 1894 1895 Set the text box attributes. 1896 %End 1897 1898 bool IsDefault() const; 1899 %Docstring 1900 IsDefault() -> bool 1901 1902 Returns true if no attributes are set. 1903 %End 1904 1905 public: 1906 1907 1908 %Property(name=TextBoxAttr, get=GetTextBoxAttr, set=SetTextBoxAttr) 1909}; // end of class wxRichTextAttr 1910 1911 1912class wxRichTextProperties : wxObject 1913{ 1914 %Docstring 1915 RichTextProperties() 1916 RichTextProperties(props) 1917 1918 A simple property class using wxVariants. 1919 %End 1920 %TypeHeaderCode 1921 #include <wx/richtext/richtextbuffer.h> 1922 %End 1923 1924public: 1925 wxRichTextProperties(); 1926 1927 wxRichTextProperties( 1928 const wxRichTextProperties & props 1929 ); 1930 1931 bool operator==( 1932 const wxRichTextProperties & props 1933 ) const; 1934 1935 void Copy( 1936 const wxRichTextProperties & props 1937 ); 1938 %Docstring 1939 Copy(props) 1940 1941 Copies from props. 1942 %End 1943 1944 void Clear(); 1945 %Docstring 1946 Clear() 1947 1948 Clears the properties. 1949 %End 1950 1951 wxRichTextVariantArray & GetProperties(); 1952 %Docstring 1953 GetProperties() -> RichTextVariantArray 1954 1955 Returns the array of variants implementing the properties. 1956 %End 1957 1958 void SetProperties( 1959 const wxRichTextVariantArray & props 1960 ); 1961 %Docstring 1962 SetProperties(props) 1963 1964 Sets the array of variants. 1965 %End 1966 1967 wxArrayString GetPropertyNames() const; 1968 %Docstring 1969 GetPropertyNames() -> ArrayString 1970 1971 Returns all the property names. 1972 %End 1973 1974 size_t GetCount() const; 1975 %Docstring 1976 GetCount() -> size_t 1977 1978 Returns a count of the properties. 1979 %End 1980 1981 bool HasProperty( 1982 const wxString & name 1983 ) const; 1984 %Docstring 1985 HasProperty(name) -> bool 1986 1987 Returns true if the given property is found. 1988 %End 1989 1990 int Find( 1991 const wxString & name 1992 ) const; 1993 %Docstring 1994 Find(name) -> int 1995 1996 Finds the given property. 1997 %End 1998 1999 bool Remove( 2000 const wxString & name 2001 ); 2002 %Docstring 2003 Remove(name) -> bool 2004 2005 Removes the given property. 2006 %End 2007 2008 const wxVariant & GetProperty( 2009 const wxString & name 2010 ) const; 2011 %Docstring 2012 GetProperty(name) -> Variant 2013 2014 Gets the property variant by name. 2015 %End 2016 2017 wxVariant * FindOrCreateProperty( 2018 const wxString & name 2019 ); 2020 %Docstring 2021 FindOrCreateProperty(name) -> Variant 2022 2023 Finds or creates a property with the given name, returning a pointer 2024 to the variant. 2025 %End 2026 2027 wxString GetPropertyString( 2028 const wxString & name 2029 ) const; 2030 %Docstring 2031 GetPropertyString(name) -> String 2032 2033 Gets the value of the named property as a string. 2034 %End 2035 2036 long GetPropertyLong( 2037 const wxString & name 2038 ) const; 2039 %Docstring 2040 GetPropertyLong(name) -> long 2041 2042 Gets the value of the named property as a long integer. 2043 %End 2044 2045 bool GetPropertyBool( 2046 const wxString & name 2047 ) const; 2048 %Docstring 2049 GetPropertyBool(name) -> bool 2050 2051 Gets the value of the named property as a boolean. 2052 %End 2053 2054 double GetPropertyDouble( 2055 const wxString & name 2056 ) const; 2057 %Docstring 2058 GetPropertyDouble(name) -> double 2059 2060 Gets the value of the named property as a double. 2061 %End 2062 2063 void SetProperty( 2064 const wxVariant & variant 2065 ); 2066 %Docstring 2067 SetProperty(variant) 2068 SetProperty(name, variant) 2069 SetProperty(name, value) 2070 SetProperty(name, value) 2071 SetProperty(name, value) 2072 SetProperty(name, value) 2073 2074 Sets the property by passing a variant which contains a name and 2075 value. 2076 %End 2077 2078 void SetProperty( 2079 const wxString & name, 2080 const wxVariant & variant 2081 ); 2082 2083 void SetProperty( 2084 const wxString & name, 2085 const wxString & value 2086 ); 2087 2088 void SetProperty( 2089 const wxString & name, 2090 const wxChar * value 2091 ); 2092 2093 void SetProperty( 2094 const wxString & name, 2095 long value 2096 ); 2097 2098 void SetProperty( 2099 const wxString & name, 2100 double value 2101 ); 2102 2103 void RemoveProperties( 2104 const wxRichTextProperties & properties 2105 ); 2106 %Docstring 2107 RemoveProperties(properties) 2108 2109 Removes the given properties from these properties. 2110 %End 2111 2112 void MergeProperties( 2113 const wxRichTextProperties & properties 2114 ); 2115 %Docstring 2116 MergeProperties(properties) 2117 2118 Merges the given properties with these properties. 2119 %End 2120 2121 public: 2122 2123 2124 %Property(name=Count, get=GetCount) 2125 %Property(name=Properties, get=GetProperties, set=SetProperties) 2126 %Property(name=PropertyNames, get=GetPropertyNames) 2127}; // end of class wxRichTextProperties 2128 2129 2130class wxRichTextFontTable : wxObject 2131{ 2132 %Docstring 2133 RichTextFontTable() 2134 RichTextFontTable(table) 2135 2136 Manages quick access to a pool of fonts for rendering rich text. 2137 %End 2138 %TypeHeaderCode 2139 #include <wx/richtext/richtextbuffer.h> 2140 %End 2141 2142public: 2143 wxRichTextFontTable(); 2144 2145 wxRichTextFontTable( 2146 const wxRichTextFontTable & table 2147 ); 2148 2149 virtual 2150 ~wxRichTextFontTable(); 2151 2152 bool IsOk() const; 2153 %Docstring 2154 IsOk() -> bool 2155 2156 Returns true if the font table is valid. 2157 %End 2158 2159 wxFont FindFont( 2160 const wxRichTextAttr & fontSpec 2161 ); 2162 %Docstring 2163 FindFont(fontSpec) -> wx.Font 2164 2165 Finds a font for the given attribute object. 2166 %End 2167 2168 void Clear(); 2169 %Docstring 2170 Clear() 2171 2172 Clears the font table. 2173 %End 2174 2175 bool operator==( 2176 const wxRichTextFontTable & table 2177 ) const; 2178 2179 bool operator!=( 2180 const wxRichTextFontTable & table 2181 ) const; 2182 2183 void SetFontScale( 2184 double fontScale 2185 ); 2186 %Docstring 2187 SetFontScale(fontScale) 2188 2189 Set the font scale factor. 2190 %End 2191 2192 public: 2193 2194 2195}; // end of class wxRichTextFontTable 2196 2197 2198class wxRichTextRange 2199{ 2200 %Docstring 2201 RichTextRange() 2202 RichTextRange(start, end) 2203 RichTextRange(range) 2204 2205 This stores beginning and end positions for a range of data. 2206 %End 2207 %TypeHeaderCode 2208 #include <wx/richtext/richtextbuffer.h> 2209 %End 2210 2211public: 2212 wxRichTextRange(); 2213 2214 wxRichTextRange( 2215 long start, 2216 long end 2217 ); 2218 2219 wxRichTextRange( 2220 const wxRichTextRange & range 2221 ); 2222 2223 ~wxRichTextRange(); 2224 2225 bool operator==( 2226 const wxRichTextRange & range 2227 ) const; 2228 2229 bool operator!=( 2230 const wxRichTextRange & range 2231 ) const; 2232 2233 wxRichTextRange operator-( 2234 const wxRichTextRange & range 2235 ) const; 2236 2237 wxRichTextRange operator+( 2238 const wxRichTextRange & range 2239 ) const; 2240 2241 void SetRange( 2242 long start, 2243 long end 2244 ); 2245 %Docstring 2246 SetRange(start, end) 2247 2248 Sets the range start and end positions. 2249 %End 2250 2251 void SetStart( 2252 long start 2253 ); 2254 %Docstring 2255 SetStart(start) 2256 2257 Sets the start position. 2258 %End 2259 2260 long GetStart() const; 2261 %Docstring 2262 GetStart() -> long 2263 2264 Returns the start position. 2265 %End 2266 2267 void SetEnd( 2268 long end 2269 ); 2270 %Docstring 2271 SetEnd(end) 2272 2273 Sets the end position. 2274 %End 2275 2276 long GetEnd() const; 2277 %Docstring 2278 GetEnd() -> long 2279 2280 Gets the end position. 2281 %End 2282 2283 bool IsOutside( 2284 const wxRichTextRange & range 2285 ) const; 2286 %Docstring 2287 IsOutside(range) -> bool 2288 2289 Returns true if this range is completely outside range. 2290 %End 2291 2292 bool IsWithin( 2293 const wxRichTextRange & range 2294 ) const; 2295 %Docstring 2296 IsWithin(range) -> bool 2297 2298 Returns true if this range is completely within range. 2299 %End 2300 2301 bool Contains( 2302 long pos 2303 ) const; 2304 %Docstring 2305 Contains(pos) -> bool 2306 2307 Returns true if pos was within the range. 2308 %End 2309 2310 bool LimitTo( 2311 const wxRichTextRange & range 2312 ); 2313 %Docstring 2314 LimitTo(range) -> bool 2315 2316 Limit this range to be within range. 2317 %End 2318 2319 long GetLength() const; 2320 %Docstring 2321 GetLength() -> long 2322 2323 Gets the length of the range. 2324 %End 2325 2326 void Swap(); 2327 %Docstring 2328 Swap() 2329 2330 Swaps the start and end. 2331 %End 2332 2333 wxRichTextRange ToInternal() const; 2334 %Docstring 2335 ToInternal() -> RichTextRange 2336 2337 Converts the API-standard range, whose end is one past the last 2338 character in the range, to the internal form, which uses the first and 2339 last character positions of the range. 2340 %End 2341 2342 wxRichTextRange FromInternal() const; 2343 %Docstring 2344 FromInternal() -> RichTextRange 2345 2346 Converts the internal range, which uses the first and last character 2347 positions of the range, to the API-standard range, whose end is one 2348 past the last character in the range. 2349 %End 2350 2351 public: 2352 2353 2354 %Property(name=End, get=GetEnd, set=SetEnd) 2355 %Property(name=Length, get=GetLength) 2356 %Property(name=Start, get=GetStart, set=SetStart) 2357 PyObject* Get(); 2358 %Docstring 2359 Get() -> (start, end) 2360 2361 Return the start and end properties as a tuple. 2362 %End 2363 %MethodCode 2364 PyErr_Clear(); 2365 Py_BEGIN_ALLOW_THREADS 2366 sipRes = _wxRichTextRange_Get(sipCpp); 2367 Py_END_ALLOW_THREADS 2368 if (PyErr_Occurred()) sipIsErr = 1; 2369 %End 2370 %TypeCode 2371 PyObject* _wxRichTextRange_Get(wxRichTextRange* self) 2372 { 2373 wxPyThreadBlocker blocker; 2374 return sipBuildResult(0, "(ii)", self->GetStart(), self->GetEnd()); 2375 } 2376 %End 2377 2378 %ConvertToTypeCode 2379 // is it just a typecheck? 2380 if (!sipIsErr) { 2381 // is it already an instance of wxRichTextRange? 2382 if (sipCanConvertToType(sipPy, sipType_wxRichTextRange, SIP_NO_CONVERTORS)) 2383 return 1; 2384 2385 if (wxPyNumberSequenceCheck(sipPy, 2)) { 2386 return 1; 2387 } 2388 return 0; 2389 } 2390 2391 // otherwise do the conversion 2392 if (sipCanConvertToType(sipPy, sipType_wxRichTextRange, SIP_NO_CONVERTORS)) { 2393 // Just fetch the existing instance 2394 *sipCppPtr = reinterpret_cast<wxRichTextRange*>(sipConvertToType( 2395 sipPy, sipType_wxRichTextRange, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); 2396 return 0; // not a new instance 2397 } 2398 2399 // or create a new instance 2400 PyObject* o1 = PySequence_ITEM(sipPy, 0); 2401 PyObject* o2 = PySequence_ITEM(sipPy, 1); 2402 *sipCppPtr = new wxRichTextRange(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2)); 2403 Py_DECREF(o1); 2404 Py_DECREF(o2); 2405 return SIP_TEMPORARY; 2406 %End 2407}; // end of class wxRichTextRange 2408 2409 2410%Extract(id=pycode_richtext) 2411def _RichTextRange_GetIM(self): 2412 """ 2413 Returns an immutable representation of the ``wx.RichTextRange`` object, based on ``namedtuple``. 2414 2415 This new object is hashable and can be used as a dictionary key, 2416 be added to sets, etc. It can be converted back into a real ``wx.RichTextRange`` 2417 with a simple statement like this: ``obj = wx.RichTextRange(imObj)``. 2418 """ 2419 return _im_RichTextRange(*self.Get()) 2420RichTextRange.GetIM = _RichTextRange_GetIM 2421del _RichTextRange_GetIM 2422%End 2423 2424%Extract(id=pycode_richtext) 2425def _RichTextRange___str__(self): 2426 return str(self.Get()) 2427RichTextRange.__str__ = _RichTextRange___str__ 2428del _RichTextRange___str__ 2429%End 2430 2431%Extract(id=pycode_richtext) 2432def _RichTextRange___repr__(self): 2433 return "RichTextRange"+str(self.Get()) 2434RichTextRange.__repr__ = _RichTextRange___repr__ 2435del _RichTextRange___repr__ 2436%End 2437 2438%Extract(id=pycode_richtext) 2439def _RichTextRange___len__(self): 2440 return len(self.Get()) 2441RichTextRange.__len__ = _RichTextRange___len__ 2442del _RichTextRange___len__ 2443%End 2444 2445%Extract(id=pycode_richtext) 2446def _RichTextRange___nonzero__(self): 2447 return self.Get() != (0,0) 2448RichTextRange.__nonzero__ = _RichTextRange___nonzero__ 2449del _RichTextRange___nonzero__ 2450%End 2451 2452%Extract(id=pycode_richtext) 2453def _RichTextRange___bool__(self): 2454 return self.Get() != (0,0) 2455RichTextRange.__bool__ = _RichTextRange___bool__ 2456del _RichTextRange___bool__ 2457%End 2458 2459%Extract(id=pycode_richtext) 2460def _RichTextRange___reduce__(self): 2461 return (RichTextRange, self.Get()) 2462RichTextRange.__reduce__ = _RichTextRange___reduce__ 2463del _RichTextRange___reduce__ 2464%End 2465 2466%Extract(id=pycode_richtext) 2467def _RichTextRange___getitem__(self, idx): 2468 return self.Get()[idx] 2469RichTextRange.__getitem__ = _RichTextRange___getitem__ 2470del _RichTextRange___getitem__ 2471%End 2472 2473%Extract(id=pycode_richtext) 2474def _RichTextRange___setitem__(self, idx, val): 2475 if idx == 0: self.Start = val 2476 elif idx == 1: self.End = val 2477 else: raise IndexError 2478RichTextRange.__setitem__ = _RichTextRange___setitem__ 2479del _RichTextRange___setitem__ 2480%End 2481 2482%Extract(id=pycode_richtext) 2483RichTextRange.__safe_for_unpickling__ = True 2484 2485%End 2486 2487%Extract(id=pycode_richtext) 2488RICHTEXT_ALL = RichTextRange(-2, -2) 2489RICHTEXT_NONE = RichTextRange(-1, -1) 2490RICHTEXT_NO_SELECTION = RichTextRange(-2, -2) 2491 2492%End 2493 2494class wxRichTextSelection 2495{ 2496 %Docstring 2497 RichTextSelection(sel) 2498 RichTextSelection(range, container) 2499 RichTextSelection() 2500 2501 Stores selection information. 2502 %End 2503 %TypeHeaderCode 2504 #include <wx/richtext/richtextbuffer.h> 2505 %End 2506 2507public: 2508 wxRichTextSelection( 2509 const wxRichTextSelection & sel 2510 ); 2511 2512 wxRichTextSelection( 2513 const wxRichTextRange & range, 2514 wxRichTextParagraphLayoutBox * container 2515 ); 2516 2517 wxRichTextSelection(); 2518 2519 wxRichTextRangeArray m_ranges; 2520 2521 wxRichTextParagraphLayoutBox * m_container; 2522 2523 void Reset(); 2524 %Docstring 2525 Reset() 2526 2527 Resets the selection. 2528 %End 2529 2530 void Set( 2531 const wxRichTextRange & range, 2532 wxRichTextParagraphLayoutBox * container 2533 ); 2534 %Docstring 2535 Set(range, container) 2536 Set(ranges, container) 2537 2538 Sets the selection. 2539 %End 2540 2541 void Set( 2542 const wxRichTextRangeArray & ranges, 2543 wxRichTextParagraphLayoutBox * container 2544 ); 2545 2546 void Add( 2547 const wxRichTextRange & range 2548 ); 2549 %Docstring 2550 Add(range) 2551 2552 Adds a range to the selection. 2553 %End 2554 2555 void Copy( 2556 const wxRichTextSelection & sel 2557 ); 2558 %Docstring 2559 Copy(sel) 2560 2561 Copies from sel. 2562 %End 2563 2564 bool operator==( 2565 const wxRichTextSelection & sel 2566 ) const; 2567 2568 wxRichTextRangeArray & GetRanges(); 2569 %Docstring 2570 GetRanges() -> RichTextRangeArray 2571 2572 Returns the selection ranges. 2573 %End 2574 2575 void SetRanges( 2576 const wxRichTextRangeArray & ranges 2577 ); 2578 %Docstring 2579 SetRanges(ranges) 2580 2581 Sets the selection ranges. 2582 %End 2583 2584 size_t GetCount() const; 2585 %Docstring 2586 GetCount() -> size_t 2587 2588 Returns the number of ranges in the selection. 2589 %End 2590 2591 wxRichTextRange GetRange( 2592 size_t i 2593 ) const; 2594 %Docstring 2595 GetRange(i) -> RichTextRange 2596 GetRange() -> RichTextRange 2597 2598 Returns the range at the given index. 2599 %End 2600 2601 wxRichTextRange GetRange() const; 2602 2603 void SetRange( 2604 const wxRichTextRange & range 2605 ); 2606 %Docstring 2607 SetRange(range) 2608 2609 Sets a single range. 2610 %End 2611 2612 wxRichTextParagraphLayoutBox * GetContainer() const; 2613 %Docstring 2614 GetContainer() -> RichTextParagraphLayoutBox 2615 2616 Returns the container for which the selection is valid. 2617 %End 2618 2619 void SetContainer( 2620 wxRichTextParagraphLayoutBox * container 2621 ); 2622 %Docstring 2623 SetContainer(container) 2624 2625 Sets the container for which the selection is valid. 2626 %End 2627 2628 bool IsValid() const; 2629 %Docstring 2630 IsValid() -> bool 2631 2632 Returns true if the selection is valid. 2633 %End 2634 2635 wxRichTextRangeArray GetSelectionForObject( 2636 wxRichTextObject * obj 2637 ) const; 2638 %Docstring 2639 GetSelectionForObject(obj) -> RichTextRangeArray 2640 2641 Returns the selection appropriate to the specified object, if any; 2642 returns an empty array if none at the level of the object's container. 2643 %End 2644 2645 bool WithinSelection( 2646 long pos, 2647 wxRichTextObject * obj 2648 ) const; 2649 %Docstring 2650 WithinSelection(pos, obj) -> bool 2651 WithinSelection(pos) -> bool 2652 WithinSelection(pos, ranges) -> bool 2653 WithinSelection(range, ranges) -> bool 2654 2655 Returns true if the given position is within the selection. 2656 %End 2657 2658 bool WithinSelection( 2659 long pos 2660 ) const; 2661 2662 static 2663 bool WithinSelection( 2664 long pos, 2665 const wxRichTextRangeArray & ranges 2666 ); 2667 2668 static 2669 bool WithinSelection( 2670 const wxRichTextRange & range, 2671 const wxRichTextRangeArray & ranges 2672 ); 2673 2674 int __nonzero__(); 2675 %Docstring 2676 __nonzero__() -> int 2677 %End 2678 %MethodCode 2679 PyErr_Clear(); 2680 Py_BEGIN_ALLOW_THREADS 2681 sipRes = _wxRichTextSelection___nonzero__(sipCpp); 2682 Py_END_ALLOW_THREADS 2683 if (PyErr_Occurred()) sipIsErr = 1; 2684 %End 2685 %TypeCode 2686 int _wxRichTextSelection___nonzero__(wxRichTextSelection* self) 2687 { 2688 return self->IsValid(); 2689 } 2690 %End 2691 2692 int __bool__(); 2693 %Docstring 2694 __bool__() -> int 2695 %End 2696 %MethodCode 2697 PyErr_Clear(); 2698 Py_BEGIN_ALLOW_THREADS 2699 sipRes = _wxRichTextSelection___bool__(sipCpp); 2700 Py_END_ALLOW_THREADS 2701 if (PyErr_Occurred()) sipIsErr = 1; 2702 %End 2703 %TypeCode 2704 int _wxRichTextSelection___bool__(wxRichTextSelection* self) 2705 { 2706 return self->IsValid(); 2707 } 2708 %End 2709 2710 public: 2711 2712 2713 %Property(name=Container, get=GetContainer, set=SetContainer) 2714 %Property(name=Count, get=GetCount) 2715 %Property(name=Range, get=GetRange, set=SetRange) 2716 %Property(name=Ranges, get=GetRanges, set=SetRanges) 2717}; // end of class wxRichTextSelection 2718 2719 2720class wxRichTextDrawingContext : wxObject 2721{ 2722 %Docstring 2723 RichTextDrawingContext(buffer) 2724 2725 A class for passing information to drawing and measuring functions. 2726 %End 2727 %TypeHeaderCode 2728 #include <wx/richtext/richtextbuffer.h> 2729 %End 2730 2731public: 2732 wxRichTextDrawingContext( 2733 wxRichTextBuffer * buffer 2734 ); 2735 2736 wxRichTextBuffer * m_buffer; 2737 2738 void Init(); 2739 %Docstring 2740 Init() 2741 %End 2742 2743 bool HasVirtualAttributes( 2744 wxRichTextObject * obj 2745 ) const; 2746 %Docstring 2747 HasVirtualAttributes(obj) -> bool 2748 2749 Does this object have virtual attributes? Virtual attributes can be 2750 provided for visual cues without affecting the actual styling. 2751 %End 2752 2753 wxRichTextAttr GetVirtualAttributes( 2754 wxRichTextObject * obj 2755 ) const; 2756 %Docstring 2757 GetVirtualAttributes(obj) -> RichTextAttr 2758 2759 Returns the virtual attributes for this object. 2760 %End 2761 2762 bool ApplyVirtualAttributes( 2763 wxRichTextAttr & attr, 2764 wxRichTextObject * obj 2765 ) const; 2766 %Docstring 2767 ApplyVirtualAttributes(attr, obj) -> bool 2768 2769 Applies any virtual attributes relevant to this object. 2770 %End 2771 2772 int GetVirtualSubobjectAttributesCount( 2773 wxRichTextObject * obj 2774 ) const; 2775 %Docstring 2776 GetVirtualSubobjectAttributesCount(obj) -> int 2777 2778 Gets the count for mixed virtual attributes for individual positions 2779 within the object. 2780 %End 2781 2782 int GetVirtualSubobjectAttributes( 2783 wxRichTextObject * obj, 2784 wxArrayInt & positions, 2785 wxRichTextAttrArray & attributes 2786 ) const; 2787 %Docstring 2788 GetVirtualSubobjectAttributes(obj, positions, attributes) -> int 2789 2790 Gets the mixed virtual attributes for individual positions within the 2791 object. 2792 %End 2793 2794 bool HasVirtualText( 2795 const wxRichTextPlainText * obj 2796 ) const; 2797 %Docstring 2798 HasVirtualText(obj) -> bool 2799 2800 Do we have virtual text for this object? Virtual text allows an 2801 application to replace characters in an object for editing and display 2802 purposes, for example for highlighting special characters. 2803 %End 2804 2805 bool GetVirtualText( 2806 const wxRichTextPlainText * obj, 2807 wxString & text 2808 ) const; 2809 %Docstring 2810 GetVirtualText(obj, text) -> bool 2811 2812 Gets the virtual text for this object. 2813 %End 2814 2815 void EnableVirtualAttributes( 2816 bool b 2817 ); 2818 %Docstring 2819 EnableVirtualAttributes(b) 2820 2821 Enables virtual attribute processing. 2822 %End 2823 2824 bool GetVirtualAttributesEnabled() const; 2825 %Docstring 2826 GetVirtualAttributesEnabled() -> bool 2827 2828 Returns true if virtual attribute processing is enabled. 2829 %End 2830 2831 public: 2832 2833 2834 %Property(name=VirtualAttributesEnabled, get=GetVirtualAttributesEnabled) 2835}; // end of class wxRichTextDrawingContext 2836 2837 2838class wxRichTextObject : wxObject 2839{ 2840 %Docstring 2841 RichTextObject(parent=None) 2842 2843 This is the base for drawable rich text objects. 2844 %End 2845 %TypeHeaderCode 2846 #include <wx/richtext/richtextbuffer.h> 2847 %End 2848 2849public: 2850 wxRichTextObject( 2851 wxRichTextObject * parent = NULL 2852 ); 2853 2854 virtual 2855 ~wxRichTextObject(); 2856 2857 virtual 2858 bool Draw( 2859 wxDC & dc, 2860 wxRichTextDrawingContext & context, 2861 const wxRichTextRange & range, 2862 const wxRichTextSelection & selection, 2863 const wxRect & rect, 2864 int descent, 2865 int style 2866 ) = 0; 2867 %Docstring 2868 Draw(dc, context, range, selection, rect, descent, style) -> bool 2869 2870 Draw the item, within the given range. 2871 %End 2872 2873 virtual 2874 bool Layout( 2875 wxDC & dc, 2876 wxRichTextDrawingContext & context, 2877 const wxRect & rect, 2878 const wxRect & parentRect, 2879 int style 2880 ) = 0; 2881 %Docstring 2882 Layout(dc, context, rect, parentRect, style) -> bool 2883 2884 Lay the item out at the specified position with the given size 2885 constraint. 2886 %End 2887 2888 virtual 2889 int HitTest( 2890 wxDC & dc, 2891 wxRichTextDrawingContext & context, 2892 const wxPoint & pt, 2893 long & textPosition /Out/, 2894 wxRichTextObject ** obj /Out/, 2895 wxRichTextObject ** contextObj /Out/, 2896 int flags = 0 2897 ); 2898 %Docstring 2899 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 2900 2901 Hit-testing: returns a flag indicating hit test details, plus 2902 information about position. 2903 %End 2904 2905 virtual 2906 bool FindPosition( 2907 wxDC & dc, 2908 wxRichTextDrawingContext & context, 2909 long index, 2910 wxPoint & pt /Out/, 2911 int * height /Out/, 2912 bool forceLineStart 2913 ); 2914 %Docstring 2915 FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height) 2916 2917 Finds the absolute position and row height for the given character 2918 position. 2919 %End 2920 2921 virtual 2922 wxSize GetBestSize() const; 2923 %Docstring 2924 GetBestSize() -> wx.Size 2925 2926 Returns the best size, i.e. the ideal starting size for this object 2927 irrespective of available space. 2928 %End 2929 2930 virtual 2931 bool GetRangeSize( 2932 const wxRichTextRange & range, 2933 wxSize & size, 2934 int & descent, 2935 wxDC & dc, 2936 wxRichTextDrawingContext & context, 2937 int flags, 2938 const wxPoint & position = wxPoint(0, 0), 2939 const wxSize & parentSize = wxDefaultSize, 2940 wxArrayInt * partialExtents = NULL 2941 ) const = 0; 2942 %Docstring 2943 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 2944 2945 Returns the object size for the given range. 2946 %End 2947 2948 virtual 2949 wxRichTextObject * DoSplit( 2950 long pos 2951 ); 2952 %Docstring 2953 DoSplit(pos) -> RichTextObject 2954 2955 Do a split from pos, returning an object containing the second part, 2956 and setting the first part in 'this'. 2957 %End 2958 2959 virtual 2960 void CalculateRange( 2961 long start, 2962 long & end /Out/ 2963 ); 2964 %Docstring 2965 CalculateRange(start) -> end 2966 2967 Calculates the range of the object. 2968 %End 2969 2970 virtual 2971 bool DeleteRange( 2972 const wxRichTextRange & range 2973 ); 2974 %Docstring 2975 DeleteRange(range) -> bool 2976 2977 Deletes the given range. 2978 %End 2979 2980 virtual 2981 bool IsEmpty() const; 2982 %Docstring 2983 IsEmpty() -> bool 2984 2985 Returns true if the object is empty. 2986 %End 2987 2988 virtual 2989 bool IsFloatable() const; 2990 %Docstring 2991 IsFloatable() -> bool 2992 2993 Returns true if this class of object is floatable. 2994 %End 2995 2996 virtual 2997 bool IsFloating() const; 2998 %Docstring 2999 IsFloating() -> bool 3000 3001 Returns true if this object is currently floating. 3002 %End 3003 3004 virtual 3005 int GetFloatDirection() const; 3006 %Docstring 3007 GetFloatDirection() -> int 3008 3009 Returns the floating direction. 3010 %End 3011 3012 virtual 3013 wxString GetTextForRange( 3014 const wxRichTextRange & range 3015 ) const; 3016 %Docstring 3017 GetTextForRange(range) -> String 3018 3019 Returns any text in this object for the given range. 3020 %End 3021 3022 virtual 3023 bool CanMerge( 3024 wxRichTextObject * object, 3025 wxRichTextDrawingContext & context 3026 ) const; 3027 %Docstring 3028 CanMerge(object, context) -> bool 3029 3030 Returns true if this object can merge itself with the given one. 3031 %End 3032 3033 virtual 3034 bool Merge( 3035 wxRichTextObject * object, 3036 wxRichTextDrawingContext & context 3037 ); 3038 %Docstring 3039 Merge(object, context) -> bool 3040 3041 Returns true if this object merged itself with the given one. 3042 %End 3043 3044 virtual 3045 bool CanSplit( 3046 wxRichTextDrawingContext & context 3047 ) const; 3048 %Docstring 3049 CanSplit(context) -> bool 3050 3051 Returns true if this object can potentially be split, by virtue of 3052 having different virtual attributes for individual sub-objects. 3053 %End 3054 3055 virtual 3056 wxRichTextObject * Split( 3057 wxRichTextDrawingContext & context 3058 ); 3059 %Docstring 3060 Split(context) -> RichTextObject 3061 3062 Returns the final object in the split objects if this object was split 3063 due to differences between sub-object virtual attributes. 3064 %End 3065 3066 virtual 3067 bool CanEditProperties() const; 3068 %Docstring 3069 CanEditProperties() -> bool 3070 3071 Returns true if we can edit the object's properties via a GUI. 3072 %End 3073 3074 virtual 3075 bool EditProperties( 3076 wxWindow * parent, 3077 wxRichTextBuffer * buffer 3078 ); 3079 %Docstring 3080 EditProperties(parent, buffer) -> bool 3081 3082 Edits the object's properties via a GUI. 3083 %End 3084 3085 virtual 3086 wxString GetPropertiesMenuLabel() const; 3087 %Docstring 3088 GetPropertiesMenuLabel() -> String 3089 3090 Returns the label to be used for the properties context menu item. 3091 %End 3092 3093 virtual 3094 bool AcceptsFocus() const; 3095 %Docstring 3096 AcceptsFocus() -> bool 3097 3098 Returns true if objects of this class can accept the focus, i.e. a 3099 call to SetFocusObject is possible. 3100 %End 3101 3102 virtual 3103 bool ImportFromXML( 3104 wxRichTextBuffer * buffer, 3105 wxXmlNode * node, 3106 wxRichTextXMLHandler * handler, 3107 bool * recurse 3108 ); 3109 %Docstring 3110 ImportFromXML(buffer, node, handler, recurse) -> bool 3111 3112 Imports this object from XML. 3113 %End 3114 3115 virtual 3116 bool UsesParagraphAttributes() const; 3117 %Docstring 3118 UsesParagraphAttributes() -> bool 3119 3120 Returns true if this object takes note of paragraph attributes (text 3121 and image objects don't). 3122 %End 3123 3124 virtual 3125 wxString GetXMLNodeName() const; 3126 %Docstring 3127 GetXMLNodeName() -> String 3128 3129 Returns the XML node name of this object. 3130 %End 3131 3132 virtual 3133 void Invalidate( 3134 const wxRichTextRange & invalidRange = wxRICHTEXT_ALL 3135 ); 3136 %Docstring 3137 Invalidate(invalidRange=RICHTEXT_ALL) 3138 3139 Invalidates the object at the given range. 3140 %End 3141 3142 virtual 3143 bool HandlesChildSelections() const; 3144 %Docstring 3145 HandlesChildSelections() -> bool 3146 3147 Returns true if this object can handle the selections of its children, 3148 fOr example a table. 3149 %End 3150 3151 virtual 3152 wxRichTextSelection GetSelection( 3153 long start, 3154 long end 3155 ) const; 3156 %Docstring 3157 GetSelection(start, end) -> RichTextSelection 3158 3159 Returns a selection object specifying the selections between start and 3160 end character positions. 3161 %End 3162 3163 virtual 3164 wxSize GetCachedSize() const; 3165 %Docstring 3166 GetCachedSize() -> wx.Size 3167 3168 Gets the cached object size as calculated by Layout. 3169 %End 3170 3171 virtual 3172 void SetCachedSize( 3173 const wxSize & sz 3174 ); 3175 %Docstring 3176 SetCachedSize(sz) 3177 3178 Sets the cached object size as calculated by Layout. 3179 %End 3180 3181 virtual 3182 wxSize GetMaxSize() const; 3183 %Docstring 3184 GetMaxSize() -> wx.Size 3185 3186 Gets the maximum object size as calculated by Layout. 3187 %End 3188 3189 virtual 3190 void SetMaxSize( 3191 const wxSize & sz 3192 ); 3193 %Docstring 3194 SetMaxSize(sz) 3195 3196 Sets the maximum object size as calculated by Layout. 3197 %End 3198 3199 virtual 3200 wxSize GetMinSize() const; 3201 %Docstring 3202 GetMinSize() -> wx.Size 3203 3204 Gets the minimum object size as calculated by Layout. 3205 %End 3206 3207 virtual 3208 void SetMinSize( 3209 const wxSize & sz 3210 ); 3211 %Docstring 3212 SetMinSize(sz) 3213 3214 Sets the minimum object size as calculated by Layout. 3215 %End 3216 3217 virtual 3218 wxTextAttrSize GetNaturalSize() const; 3219 %Docstring 3220 GetNaturalSize() -> TextAttrSize 3221 3222 Gets the 'natural' size for an object. 3223 %End 3224 3225 virtual 3226 wxPoint GetPosition() const; 3227 %Docstring 3228 GetPosition() -> wx.Point 3229 3230 Returns the object position in pixels. 3231 %End 3232 3233 virtual 3234 void SetPosition( 3235 const wxPoint & pos 3236 ); 3237 %Docstring 3238 SetPosition(pos) 3239 3240 Sets the object position in pixels. 3241 %End 3242 3243 virtual 3244 wxPoint GetAbsolutePosition() const; 3245 %Docstring 3246 GetAbsolutePosition() -> wx.Point 3247 3248 Returns the absolute object position, by traversing up the 3249 child/parent hierarchy. 3250 %End 3251 3252 virtual 3253 wxRect GetRect() const; 3254 %Docstring 3255 GetRect() -> wx.Rect 3256 3257 Returns the rectangle enclosing the object. 3258 %End 3259 3260 void SetRange( 3261 const wxRichTextRange & range 3262 ); 3263 %Docstring 3264 SetRange(range) 3265 3266 Sets the object's range within its container. 3267 %End 3268 3269 wxRichTextRange & GetRange(); 3270 %Docstring 3271 GetRange() -> RichTextRange 3272 3273 Returns the object's range. 3274 %End 3275 3276 void SetOwnRange( 3277 const wxRichTextRange & range 3278 ); 3279 %Docstring 3280 SetOwnRange(range) 3281 3282 Set the object's own range, for a top-level object with its own 3283 position space. 3284 %End 3285 3286 wxRichTextRange & GetOwnRange(); 3287 %Docstring 3288 GetOwnRange() -> RichTextRange 3289 3290 Returns the object's own range (valid if top-level). 3291 %End 3292 3293 wxRichTextRange GetOwnRangeIfTopLevel() const; 3294 %Docstring 3295 GetOwnRangeIfTopLevel() -> RichTextRange 3296 3297 Returns the object's own range only if a top-level object. 3298 %End 3299 3300 virtual 3301 bool IsComposite() const; 3302 %Docstring 3303 IsComposite() -> bool 3304 3305 Returns true if this object is composite. 3306 %End 3307 3308 virtual 3309 bool IsAtomic() const; 3310 %Docstring 3311 IsAtomic() -> bool 3312 3313 Returns true if no user editing can be done inside the object. 3314 %End 3315 3316 virtual 3317 wxRichTextObject * GetParent() const; 3318 %Docstring 3319 GetParent() -> RichTextObject 3320 3321 Returns a pointer to the parent object. 3322 %End 3323 3324 virtual 3325 void SetParent( 3326 wxRichTextObject * parent 3327 ); 3328 %Docstring 3329 SetParent(parent) 3330 3331 Sets the pointer to the parent object. 3332 %End 3333 3334 virtual 3335 wxRichTextParagraphLayoutBox * GetContainer() const; 3336 %Docstring 3337 GetContainer() -> RichTextParagraphLayoutBox 3338 3339 Returns the top-level container of this object. 3340 %End 3341 3342 virtual 3343 wxRichTextParagraphLayoutBox * GetParentContainer() const; 3344 %Docstring 3345 GetParentContainer() -> RichTextParagraphLayoutBox 3346 3347 Returns the top-level container of this object. 3348 %End 3349 3350 virtual 3351 void SetMargins( 3352 int margin 3353 ); 3354 %Docstring 3355 SetMargins(margin) 3356 SetMargins(leftMargin, rightMargin, topMargin, bottomMargin) 3357 3358 Set the margin around the object, in pixels. 3359 %End 3360 3361 virtual 3362 void SetMargins( 3363 int leftMargin, 3364 int rightMargin, 3365 int topMargin, 3366 int bottomMargin 3367 ); 3368 3369 virtual 3370 int GetLeftMargin() const; 3371 %Docstring 3372 GetLeftMargin() -> int 3373 3374 Returns the left margin of the object, in pixels. 3375 %End 3376 3377 virtual 3378 int GetRightMargin() const; 3379 %Docstring 3380 GetRightMargin() -> int 3381 3382 Returns the right margin of the object, in pixels. 3383 %End 3384 3385 virtual 3386 int GetTopMargin() const; 3387 %Docstring 3388 GetTopMargin() -> int 3389 3390 Returns the top margin of the object, in pixels. 3391 %End 3392 3393 virtual 3394 int GetBottomMargin() const; 3395 %Docstring 3396 GetBottomMargin() -> int 3397 3398 Returns the bottom margin of the object, in pixels. 3399 %End 3400 3401 virtual 3402 wxRect GetAvailableContentArea( 3403 wxDC & dc, 3404 wxRichTextDrawingContext & context, 3405 const wxRect & outerRect 3406 ) const; 3407 %Docstring 3408 GetAvailableContentArea(dc, context, outerRect) -> wx.Rect 3409 3410 Calculates the available content space in the given rectangle, given 3411 the margins, border and padding specified in the object's attributes. 3412 %End 3413 3414 virtual 3415 bool LayoutToBestSize( 3416 wxDC & dc, 3417 wxRichTextDrawingContext & context, 3418 wxRichTextBuffer * buffer, 3419 const wxRichTextAttr & parentAttr, 3420 const wxRichTextAttr & attr, 3421 const wxRect & availableParentSpace, 3422 const wxRect & availableContainerSpace, 3423 int style 3424 ); 3425 %Docstring 3426 LayoutToBestSize(dc, context, buffer, parentAttr, attr, availableParentSpace, availableContainerSpace, style) -> bool 3427 3428 Lays out the object first with a given amount of space, and then if no 3429 width was specified in attr, lays out the object again using the 3430 minimum size. 3431 %End 3432 3433 virtual 3434 bool AdjustAttributes( 3435 wxRichTextAttr & attr, 3436 wxRichTextDrawingContext & context 3437 ); 3438 %Docstring 3439 AdjustAttributes(attr, context) -> bool 3440 3441 Adjusts the attributes for virtual attribute provision, collapsed 3442 borders, etc. 3443 %End 3444 3445 void SetAttributes( 3446 const wxRichTextAttr & attr 3447 ); 3448 %Docstring 3449 SetAttributes(attr) 3450 3451 Sets the object's attributes. 3452 %End 3453 3454 wxRichTextAttr & GetAttributes(); 3455 %Docstring 3456 GetAttributes() -> RichTextAttr 3457 3458 Returns the object's attributes. 3459 %End 3460 3461 wxRichTextProperties & GetProperties(); 3462 %Docstring 3463 GetProperties() -> RichTextProperties 3464 3465 Returns the object's properties. 3466 %End 3467 3468 void SetProperties( 3469 const wxRichTextProperties & props 3470 ); 3471 %Docstring 3472 SetProperties(props) 3473 3474 Sets the object's properties. 3475 %End 3476 3477 void SetDescent( 3478 int descent 3479 ); 3480 %Docstring 3481 SetDescent(descent) 3482 3483 Sets the stored descent value. 3484 %End 3485 3486 int GetDescent() const; 3487 %Docstring 3488 GetDescent() -> int 3489 3490 Returns the stored descent value. 3491 %End 3492 3493 wxRichTextBuffer * GetBuffer() const; 3494 %Docstring 3495 GetBuffer() -> RichTextBuffer 3496 3497 Returns the containing buffer. 3498 %End 3499 3500 void SetName( 3501 const wxString & name 3502 ); 3503 %Docstring 3504 SetName(name) 3505 3506 Sets the identifying name for this object as a property using the 3507 "name" key. 3508 %End 3509 3510 wxString GetName() const; 3511 %Docstring 3512 GetName() -> String 3513 3514 Returns the identifying name for this object from the properties, 3515 using the "name" key. 3516 %End 3517 3518 virtual 3519 bool IsTopLevel() const; 3520 %Docstring 3521 IsTopLevel() -> bool 3522 3523 Returns true if this object is top-level, i.e. contains its own 3524 paragraphs, such as a text box. 3525 %End 3526 3527 bool IsShown() const; 3528 %Docstring 3529 IsShown() -> bool 3530 3531 Returns true if the object will be shown, false otherwise. 3532 %End 3533 3534 virtual 3535 void Show( 3536 bool show 3537 ); 3538 %Docstring 3539 Show(show) 3540 3541 Call to show or hide this object. 3542 %End 3543 3544 virtual 3545 wxRichTextObject * Clone() const /Factory/; 3546 %Docstring 3547 Clone() -> RichTextObject 3548 3549 Clones the object. 3550 %End 3551 3552 void Copy( 3553 const wxRichTextObject & obj 3554 ); 3555 %Docstring 3556 Copy(obj) 3557 3558 Copies the object. 3559 %End 3560 3561 void Reference(); 3562 %Docstring 3563 Reference() 3564 3565 Reference-counting allows us to use the same object in multiple lists 3566 (not yet used). 3567 %End 3568 3569 void Dereference(); 3570 %Docstring 3571 Dereference() 3572 3573 Reference-counting allows us to use the same object in multiple lists 3574 (not yet used). 3575 %End 3576 3577 virtual 3578 void Move( 3579 const wxPoint & pt 3580 ); 3581 %Docstring 3582 Move(pt) 3583 3584 Moves the object recursively, by adding the offset from old to new. 3585 %End 3586 3587 int ConvertTenthsMMToPixels( 3588 wxDC & dc, 3589 int units 3590 ) const; 3591 %Docstring 3592 ConvertTenthsMMToPixels(dc, units) -> int 3593 ConvertTenthsMMToPixels(ppi, units, scale=1.0) -> int 3594 3595 Converts units in tenths of a millimetre to device units. 3596 %End 3597 3598 static 3599 int ConvertTenthsMMToPixels( 3600 int ppi, 3601 int units, 3602 double scale = 1.0 3603 ); 3604 3605 int ConvertPixelsToTenthsMM( 3606 wxDC & dc, 3607 int pixels 3608 ) const; 3609 %Docstring 3610 ConvertPixelsToTenthsMM(dc, pixels) -> int 3611 ConvertPixelsToTenthsMM(ppi, pixels, scale=1.0) -> int 3612 3613 Convert units in pixels to tenths of a millimetre. 3614 %End 3615 3616 static 3617 int ConvertPixelsToTenthsMM( 3618 int ppi, 3619 int pixels, 3620 double scale = 1.0 3621 ); 3622 3623 static 3624 bool DrawBoxAttributes( 3625 wxDC & dc, 3626 wxRichTextBuffer * buffer, 3627 const wxRichTextAttr & attr, 3628 const wxRect & boxRect, 3629 int flags = 0, 3630 wxRichTextObject * obj = NULL 3631 ); 3632 %Docstring 3633 DrawBoxAttributes(dc, buffer, attr, boxRect, flags=0, obj=None) -> bool 3634 3635 Draws the borders and background for the given rectangle and 3636 attributes. 3637 %End 3638 3639 static 3640 bool DrawBorder( 3641 wxDC & dc, 3642 wxRichTextBuffer * buffer, 3643 const wxTextAttrBorders & attr, 3644 const wxRect & rect, 3645 int flags = 0 3646 ); 3647 %Docstring 3648 DrawBorder(dc, buffer, attr, rect, flags=0) -> bool 3649 3650 Draws a border. 3651 %End 3652 3653 static 3654 bool GetBoxRects( 3655 wxDC & dc, 3656 wxRichTextBuffer * buffer, 3657 const wxRichTextAttr & attr, 3658 wxRect & marginRect /Out/, 3659 wxRect & borderRect /Out/, 3660 wxRect & contentRect /Out/, 3661 wxRect & paddingRect /Out/, 3662 wxRect & outlineRect /Out/ 3663 ); 3664 %Docstring 3665 GetBoxRects(dc, buffer, attr) -> (bool, marginRect, borderRect, contentRect, paddingRect, outlineRect) 3666 3667 Returns the various rectangles of the box model in pixels. 3668 %End 3669 3670 static 3671 bool GetTotalMargin( 3672 wxDC & dc, 3673 wxRichTextBuffer * buffer, 3674 const wxRichTextAttr & attr, 3675 int & leftMargin /Out/, 3676 int & rightMargin /Out/, 3677 int & topMargin /Out/, 3678 int & bottomMargin /Out/ 3679 ); 3680 %Docstring 3681 GetTotalMargin(dc, buffer, attr) -> (bool, leftMargin, rightMargin, topMargin, bottomMargin) 3682 3683 Returns the total margin for the object in pixels, taking into account 3684 margin, padding and border size. 3685 %End 3686 3687 static 3688 wxRect AdjustAvailableSpace( 3689 wxDC & dc, 3690 wxRichTextBuffer * buffer, 3691 const wxRichTextAttr & parentAttr, 3692 const wxRichTextAttr & childAttr, 3693 const wxRect & availableParentSpace, 3694 const wxRect & availableContainerSpace 3695 ); 3696 %Docstring 3697 AdjustAvailableSpace(dc, buffer, parentAttr, childAttr, availableParentSpace, availableContainerSpace) -> wx.Rect 3698 3699 Returns the rectangle which the child has available to it given 3700 restrictions specified in the child attribute, e.g. 3701 %End 3702 3703 public: 3704 3705 3706 %Property(name=AbsolutePosition, get=GetAbsolutePosition) 3707 %Property(name=Attributes, get=GetAttributes, set=SetAttributes) 3708 %Property(name=BestSize, get=GetBestSize) 3709 %Property(name=BottomMargin, get=GetBottomMargin) 3710 %Property(name=Buffer, get=GetBuffer) 3711 %Property(name=CachedSize, get=GetCachedSize, set=SetCachedSize) 3712 %Property(name=Container, get=GetContainer) 3713 %Property(name=Descent, get=GetDescent, set=SetDescent) 3714 %Property(name=FloatDirection, get=GetFloatDirection) 3715 %Property(name=LeftMargin, get=GetLeftMargin) 3716 %Property(name=MaxSize, get=GetMaxSize, set=SetMaxSize) 3717 %Property(name=MinSize, get=GetMinSize, set=SetMinSize) 3718 %Property(name=Name, get=GetName, set=SetName) 3719 %Property(name=NaturalSize, get=GetNaturalSize) 3720 %Property(name=OwnRange, get=GetOwnRange, set=SetOwnRange) 3721 %Property(name=OwnRangeIfTopLevel, get=GetOwnRangeIfTopLevel) 3722 %Property(name=Parent, get=GetParent, set=SetParent) 3723 %Property(name=ParentContainer, get=GetParentContainer) 3724 %Property(name=Position, get=GetPosition, set=SetPosition) 3725 %Property(name=Properties, get=GetProperties, set=SetProperties) 3726 %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel) 3727 %Property(name=Range, get=GetRange, set=SetRange) 3728 %Property(name=Rect, get=GetRect) 3729 %Property(name=RightMargin, get=GetRightMargin) 3730 %Property(name=TopMargin, get=GetTopMargin) 3731 %Property(name=XMLNodeName, get=GetXMLNodeName) 3732}; // end of class wxRichTextObject 3733 3734 3735class wxRichTextCompositeObject : wxRichTextObject 3736{ 3737 %Docstring 3738 RichTextCompositeObject(parent=None) 3739 3740 Objects of this class can contain other objects. 3741 %End 3742 %TypeHeaderCode 3743 #include <wx/richtext/richtextbuffer.h> 3744 %End 3745 3746public: 3747 wxRichTextCompositeObject( 3748 wxRichTextObject * parent = NULL 3749 ); 3750 3751 virtual 3752 ~wxRichTextCompositeObject(); 3753 3754 virtual 3755 int HitTest( 3756 wxDC & dc, 3757 wxRichTextDrawingContext & context, 3758 const wxPoint & pt, 3759 long & textPosition /Out/, 3760 wxRichTextObject ** obj /Out/, 3761 wxRichTextObject ** contextObj /Out/, 3762 int flags = 0 3763 ); 3764 %Docstring 3765 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 3766 3767 Hit-testing: returns a flag indicating hit test details, plus 3768 information about position. 3769 %End 3770 3771 virtual 3772 bool FindPosition( 3773 wxDC & dc, 3774 wxRichTextDrawingContext & context, 3775 long index, 3776 wxPoint & pt /Out/, 3777 int * height /Out/, 3778 bool forceLineStart 3779 ); 3780 %Docstring 3781 FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height) 3782 3783 Finds the absolute position and row height for the given character 3784 position. 3785 %End 3786 3787 virtual 3788 void CalculateRange( 3789 long start, 3790 long & end /Out/ 3791 ); 3792 %Docstring 3793 CalculateRange(start) -> end 3794 3795 Calculates the range of the object. 3796 %End 3797 3798 virtual 3799 bool DeleteRange( 3800 const wxRichTextRange & range 3801 ); 3802 %Docstring 3803 DeleteRange(range) -> bool 3804 3805 Deletes the given range. 3806 %End 3807 3808 virtual 3809 wxString GetTextForRange( 3810 const wxRichTextRange & range 3811 ) const; 3812 %Docstring 3813 GetTextForRange(range) -> String 3814 3815 Returns any text in this object for the given range. 3816 %End 3817 3818 virtual 3819 bool GetRangeSize( 3820 const wxRichTextRange & range, 3821 wxSize & size, 3822 int & descent, 3823 wxDC & dc, 3824 wxRichTextDrawingContext & context, 3825 int flags, 3826 const wxPoint & position = wxPoint(0, 0), 3827 const wxSize & parentSize = wxDefaultSize, 3828 wxArrayInt * partialExtents = NULL 3829 ) const; 3830 %Docstring 3831 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 3832 3833 Returns the object size for the given range. 3834 %End 3835 3836 virtual 3837 void Invalidate( 3838 const wxRichTextRange & invalidRange = wxRICHTEXT_ALL 3839 ); 3840 %Docstring 3841 Invalidate(invalidRange=RICHTEXT_ALL) 3842 3843 Invalidates the object at the given range. 3844 %End 3845 3846 wxRichTextObjectList & GetChildren(); 3847 %Docstring 3848 GetChildren() -> RichTextObjectList 3849 3850 Returns the children. 3851 %End 3852 3853 size_t GetChildCount() const; 3854 %Docstring 3855 GetChildCount() -> size_t 3856 3857 Returns the number of children. 3858 %End 3859 3860 wxRichTextObject * GetChild( 3861 size_t n 3862 ) const; 3863 %Docstring 3864 GetChild(n) -> RichTextObject 3865 3866 Returns the nth child. 3867 %End 3868 3869 virtual 3870 bool IsComposite() const; 3871 %Docstring 3872 IsComposite() -> bool 3873 3874 Returns true if this object is composite. 3875 %End 3876 3877 virtual 3878 bool IsAtomic() const; 3879 %Docstring 3880 IsAtomic() -> bool 3881 3882 Returns true if no user editing can be done inside the object. 3883 %End 3884 3885 virtual 3886 bool IsEmpty() const; 3887 %Docstring 3888 IsEmpty() -> bool 3889 3890 Returns true if the buffer is empty. 3891 %End 3892 3893 virtual 3894 wxRichTextObject * GetChildAtPosition( 3895 long pos 3896 ) const; 3897 %Docstring 3898 GetChildAtPosition(pos) -> RichTextObject 3899 3900 Returns the child object at the given character position. 3901 %End 3902 3903 void Copy( 3904 const wxRichTextCompositeObject & obj 3905 ); 3906 %Docstring 3907 Copy(obj) 3908 %End 3909 3910 size_t AppendChild( 3911 wxRichTextObject * child 3912 ); 3913 %Docstring 3914 AppendChild(child) -> size_t 3915 3916 Appends a child, returning the position. 3917 %End 3918 3919 bool InsertChild( 3920 wxRichTextObject * child, 3921 wxRichTextObject * inFrontOf 3922 ); 3923 %Docstring 3924 InsertChild(child, inFrontOf) -> bool 3925 3926 Inserts the child in front of the given object, or at the beginning. 3927 %End 3928 3929 bool RemoveChild( 3930 wxRichTextObject * child, 3931 bool deleteChild = false 3932 ); 3933 %Docstring 3934 RemoveChild(child, deleteChild=False) -> bool 3935 3936 Removes and optionally deletes the specified child. 3937 %End 3938 3939 bool DeleteChildren(); 3940 %Docstring 3941 DeleteChildren() -> bool 3942 3943 Deletes all the children. 3944 %End 3945 3946 bool Defragment( 3947 wxRichTextDrawingContext & context, 3948 const wxRichTextRange & range = wxRICHTEXT_ALL 3949 ); 3950 %Docstring 3951 Defragment(context, range=RICHTEXT_ALL) -> bool 3952 3953 Recursively merges all pieces that can be merged. 3954 %End 3955 3956 virtual 3957 void Move( 3958 const wxPoint & pt 3959 ); 3960 %Docstring 3961 Move(pt) 3962 3963 Moves the object recursively, by adding the offset from old to new. 3964 %End 3965 3966 virtual wxRichTextObject* Clone() const /Factory/; 3967 3968 3969 public: 3970 3971 3972 %Property(name=ChildCount, get=GetChildCount) 3973 %Property(name=Children, get=GetChildren) 3974}; // end of class wxRichTextCompositeObject 3975 3976 3977class wxRichTextParagraphLayoutBox : wxRichTextCompositeObject 3978{ 3979 %Docstring 3980 RichTextParagraphLayoutBox(parent=None) 3981 RichTextParagraphLayoutBox(obj) 3982 3983 This class knows how to lay out paragraphs. 3984 %End 3985 %TypeHeaderCode 3986 #include <wx/richtext/richtextbuffer.h> 3987 %End 3988 3989public: 3990 wxRichTextParagraphLayoutBox( 3991 wxRichTextObject * parent = NULL 3992 ); 3993 3994 wxRichTextParagraphLayoutBox( 3995 const wxRichTextParagraphLayoutBox & obj 3996 ); 3997 3998 ~wxRichTextParagraphLayoutBox(); 3999 4000 virtual 4001 bool SetListStyle( 4002 const wxRichTextRange & range, 4003 wxRichTextListStyleDefinition * styleDef, 4004 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4005 int startFrom = 1, 4006 int specifiedLevel = -1 4007 ); 4008 %Docstring 4009 SetListStyle(range, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool 4010 SetListStyle(range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool 4011 4012 Sets the list attributes for the given range, passing flags to 4013 determine how the attributes are set. 4014 %End 4015 4016 virtual 4017 bool SetListStyle( 4018 const wxRichTextRange & range, 4019 const wxString & defName, 4020 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4021 int startFrom = 1, 4022 int specifiedLevel = -1 4023 ); 4024 4025 virtual 4026 bool NumberList( 4027 const wxRichTextRange & range, 4028 wxRichTextListStyleDefinition * def = NULL, 4029 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4030 int startFrom = 1, 4031 int specifiedLevel = -1 4032 ); 4033 %Docstring 4034 NumberList(range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool 4035 NumberList(range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool 4036 4037 Numbers the paragraphs in the given range. 4038 %End 4039 4040 virtual 4041 bool NumberList( 4042 const wxRichTextRange & range, 4043 const wxString & defName, 4044 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4045 int startFrom = 1, 4046 int specifiedLevel = -1 4047 ); 4048 4049 virtual 4050 bool PromoteList( 4051 int promoteBy, 4052 const wxRichTextRange & range, 4053 wxRichTextListStyleDefinition * def = NULL, 4054 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4055 int specifiedLevel = -1 4056 ); 4057 %Docstring 4058 PromoteList(promoteBy, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1) -> bool 4059 PromoteList(promoteBy, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1) -> bool 4060 4061 Promotes the list items within the given range. 4062 %End 4063 4064 virtual 4065 bool PromoteList( 4066 int promoteBy, 4067 const wxRichTextRange & range, 4068 const wxString & defName, 4069 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4070 int specifiedLevel = -1 4071 ); 4072 4073 virtual 4074 int HitTest( 4075 wxDC & dc, 4076 wxRichTextDrawingContext & context, 4077 const wxPoint & pt, 4078 long & textPosition /Out/, 4079 wxRichTextObject ** obj /Out/, 4080 wxRichTextObject ** contextObj /Out/, 4081 int flags = 0 4082 ); 4083 %Docstring 4084 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 4085 4086 Hit-testing: returns a flag indicating hit test details, plus 4087 information about position. 4088 %End 4089 4090 virtual 4091 bool Draw( 4092 wxDC & dc, 4093 wxRichTextDrawingContext & context, 4094 const wxRichTextRange & range, 4095 const wxRichTextSelection & selection, 4096 const wxRect & rect, 4097 int descent, 4098 int style 4099 ); 4100 %Docstring 4101 Draw(dc, context, range, selection, rect, descent, style) -> bool 4102 4103 Draw the item, within the given range. 4104 %End 4105 4106 virtual 4107 bool Layout( 4108 wxDC & dc, 4109 wxRichTextDrawingContext & context, 4110 const wxRect & rect, 4111 const wxRect & parentRect, 4112 int style 4113 ); 4114 %Docstring 4115 Layout(dc, context, rect, parentRect, style) -> bool 4116 4117 Lay the item out at the specified position with the given size 4118 constraint. 4119 %End 4120 4121 virtual 4122 bool GetRangeSize( 4123 const wxRichTextRange & range, 4124 wxSize & size, 4125 int & descent, 4126 wxDC & dc, 4127 wxRichTextDrawingContext & context, 4128 int flags, 4129 const wxPoint & position = wxPoint(0, 0), 4130 const wxSize & parentSize = wxDefaultSize, 4131 wxArrayInt * partialExtents = NULL 4132 ) const; 4133 %Docstring 4134 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 4135 4136 Returns the object size for the given range. 4137 %End 4138 4139 virtual 4140 bool DeleteRange( 4141 const wxRichTextRange & range 4142 ); 4143 %Docstring 4144 DeleteRange(range) -> bool 4145 4146 Deletes the given range. 4147 %End 4148 4149 virtual 4150 wxString GetTextForRange( 4151 const wxRichTextRange & range 4152 ) const; 4153 %Docstring 4154 GetTextForRange(range) -> String 4155 4156 Returns any text in this object for the given range. 4157 %End 4158 4159 virtual 4160 bool ImportFromXML( 4161 wxRichTextBuffer * buffer, 4162 wxXmlNode * node, 4163 wxRichTextXMLHandler * handler, 4164 bool * recurse 4165 ); 4166 %Docstring 4167 ImportFromXML(buffer, node, handler, recurse) -> bool 4168 4169 Imports this object from XML. 4170 %End 4171 4172 virtual 4173 wxString GetXMLNodeName() const; 4174 %Docstring 4175 GetXMLNodeName() -> String 4176 4177 Returns the XML node name of this object. 4178 %End 4179 4180 virtual 4181 bool AcceptsFocus() const; 4182 %Docstring 4183 AcceptsFocus() -> bool 4184 4185 Returns true if objects of this class can accept the focus, i.e. a 4186 call to SetFocusObject is possible. 4187 %End 4188 4189 void SetRichTextCtrl( 4190 wxRichTextCtrl * ctrl 4191 ); 4192 %Docstring 4193 SetRichTextCtrl(ctrl) 4194 4195 Associates a control with the buffer, for operations that for example 4196 require refreshing the window. 4197 %End 4198 4199 wxRichTextCtrl * GetRichTextCtrl() const; 4200 %Docstring 4201 GetRichTextCtrl() -> RichTextCtrl 4202 4203 Returns the associated control. 4204 %End 4205 4206 void SetPartialParagraph( 4207 bool partialPara 4208 ); 4209 %Docstring 4210 SetPartialParagraph(partialPara) 4211 4212 Sets a flag indicating whether the last paragraph is partial or 4213 complete. 4214 %End 4215 4216 bool GetPartialParagraph() const; 4217 %Docstring 4218 GetPartialParagraph() -> bool 4219 4220 Returns a flag indicating whether the last paragraph is partial or 4221 complete. 4222 %End 4223 4224 virtual 4225 wxRichTextStyleSheet * GetStyleSheet() const; 4226 %Docstring 4227 GetStyleSheet() -> RichTextStyleSheet 4228 4229 Returns the style sheet associated with the overall buffer. 4230 %End 4231 4232 virtual 4233 bool IsTopLevel() const; 4234 %Docstring 4235 IsTopLevel() -> bool 4236 4237 Returns true if this object is top-level, i.e. contains its own 4238 paragraphs, such as a text box. 4239 %End 4240 4241 bool InsertParagraphsWithUndo( 4242 wxRichTextBuffer * buffer, 4243 long pos, 4244 const wxRichTextParagraphLayoutBox & paragraphs, 4245 wxRichTextCtrl * ctrl, 4246 int flags = 0 4247 ); 4248 %Docstring 4249 InsertParagraphsWithUndo(buffer, pos, paragraphs, ctrl, flags=0) -> bool 4250 4251 Submits a command to insert paragraphs. 4252 %End 4253 4254 bool InsertTextWithUndo( 4255 wxRichTextBuffer * buffer, 4256 long pos, 4257 const wxString & text, 4258 wxRichTextCtrl * ctrl, 4259 int flags = 0 4260 ); 4261 %Docstring 4262 InsertTextWithUndo(buffer, pos, text, ctrl, flags=0) -> bool 4263 4264 Submits a command to insert the given text. 4265 %End 4266 4267 bool InsertNewlineWithUndo( 4268 wxRichTextBuffer * buffer, 4269 long pos, 4270 wxRichTextCtrl * ctrl, 4271 int flags = 0 4272 ); 4273 %Docstring 4274 InsertNewlineWithUndo(buffer, pos, ctrl, flags=0) -> bool 4275 4276 Submits a command to insert the given text. 4277 %End 4278 4279 bool InsertImageWithUndo( 4280 wxRichTextBuffer * buffer, 4281 long pos, 4282 const wxRichTextImageBlock & imageBlock, 4283 wxRichTextCtrl * ctrl, 4284 int flags, 4285 const wxRichTextAttr & textAttr 4286 ); 4287 %Docstring 4288 InsertImageWithUndo(buffer, pos, imageBlock, ctrl, flags, textAttr) -> bool 4289 4290 Submits a command to insert the given image. 4291 %End 4292 4293 wxRichTextField * InsertFieldWithUndo( 4294 wxRichTextBuffer * buffer, 4295 long pos, 4296 const wxString & fieldType, 4297 const wxRichTextProperties & properties, 4298 wxRichTextCtrl * ctrl, 4299 int flags, 4300 const wxRichTextAttr & textAttr 4301 ); 4302 %Docstring 4303 InsertFieldWithUndo(buffer, pos, fieldType, properties, ctrl, flags, textAttr) -> RichTextField 4304 4305 Submits a command to insert the given field. 4306 %End 4307 4308 wxRichTextAttr GetStyleForNewParagraph( 4309 wxRichTextBuffer * buffer, 4310 long pos, 4311 bool caretPosition = false, 4312 bool lookUpNewParaStyle = false 4313 ) const; 4314 %Docstring 4315 GetStyleForNewParagraph(buffer, pos, caretPosition=False, lookUpNewParaStyle=False) -> RichTextAttr 4316 4317 Returns the style that is appropriate for a new paragraph at this 4318 position. 4319 %End 4320 4321 wxRichTextObject * InsertObjectWithUndo( 4322 wxRichTextBuffer * buffer, 4323 long pos, 4324 wxRichTextObject * object, 4325 wxRichTextCtrl * ctrl, 4326 int flags = 0 4327 ); 4328 %Docstring 4329 InsertObjectWithUndo(buffer, pos, object, ctrl, flags=0) -> RichTextObject 4330 4331 Inserts an object. 4332 %End 4333 4334 bool DeleteRangeWithUndo( 4335 const wxRichTextRange & range, 4336 wxRichTextCtrl * ctrl, 4337 wxRichTextBuffer * buffer 4338 ); 4339 %Docstring 4340 DeleteRangeWithUndo(range, ctrl, buffer) -> bool 4341 4342 Submits a command to delete this range. 4343 %End 4344 4345 void DrawFloats( 4346 wxDC & dc, 4347 wxRichTextDrawingContext & context, 4348 const wxRichTextRange & range, 4349 const wxRichTextSelection & selection, 4350 const wxRect & rect, 4351 int descent, 4352 int style 4353 ); 4354 %Docstring 4355 DrawFloats(dc, context, range, selection, rect, descent, style) 4356 4357 Draws the floating objects in this buffer. 4358 %End 4359 4360 void MoveAnchoredObjectToParagraph( 4361 wxRichTextParagraph * from_, 4362 wxRichTextParagraph * to_, 4363 wxRichTextObject * obj 4364 ); 4365 %Docstring 4366 MoveAnchoredObjectToParagraph(from_, to_, obj) 4367 4368 Moves an anchored object to another paragraph. 4369 %End 4370 4371 void Init(); 4372 %Docstring 4373 Init() 4374 4375 Initializes the object. 4376 %End 4377 4378 virtual 4379 void Clear(); 4380 %Docstring 4381 Clear() 4382 4383 Clears all the children. 4384 %End 4385 4386 virtual 4387 void Reset(); 4388 %Docstring 4389 Reset() 4390 4391 Clears and initializes with one blank paragraph. 4392 %End 4393 4394 virtual 4395 wxRichTextRange AddParagraph( 4396 const wxString & text, 4397 wxRichTextAttr * paraStyle = NULL 4398 ); 4399 %Docstring 4400 AddParagraph(text, paraStyle=None) -> RichTextRange 4401 4402 Convenience function to add a paragraph of text. 4403 %End 4404 4405 virtual 4406 wxRichTextRange AddImage( 4407 const wxImage & image, 4408 wxRichTextAttr * paraStyle = NULL 4409 ); 4410 %Docstring 4411 AddImage(image, paraStyle=None) -> RichTextRange 4412 4413 Convenience function to add an image. 4414 %End 4415 4416 virtual 4417 wxRichTextRange AddParagraphs( 4418 const wxString & text, 4419 wxRichTextAttr * paraStyle = NULL 4420 ); 4421 %Docstring 4422 AddParagraphs(text, paraStyle=None) -> RichTextRange 4423 4424 Adds multiple paragraphs, based on newlines. 4425 %End 4426 4427 virtual 4428 wxRichTextLine * GetLineAtPosition( 4429 long pos, 4430 bool caretPosition = false 4431 ) const; 4432 %Docstring 4433 GetLineAtPosition(pos, caretPosition=False) -> RichTextLine 4434 4435 Returns the line at the given position. 4436 %End 4437 4438 virtual 4439 wxRichTextLine * GetLineAtYPosition( 4440 int y 4441 ) const; 4442 %Docstring 4443 GetLineAtYPosition(y) -> RichTextLine 4444 4445 Returns the line at the given y pixel position, or the last line. 4446 %End 4447 4448 virtual 4449 wxRichTextParagraph * GetParagraphAtPosition( 4450 long pos, 4451 bool caretPosition = false 4452 ) const; 4453 %Docstring 4454 GetParagraphAtPosition(pos, caretPosition=False) -> RichTextParagraph 4455 4456 Returns the paragraph at the given character or caret position. 4457 %End 4458 4459 virtual 4460 wxSize GetLineSizeAtPosition( 4461 long pos, 4462 bool caretPosition = false 4463 ) const; 4464 %Docstring 4465 GetLineSizeAtPosition(pos, caretPosition=False) -> wx.Size 4466 4467 Returns the line size at the given position. 4468 %End 4469 4470 virtual 4471 long GetVisibleLineNumber( 4472 long pos, 4473 bool caretPosition = false, 4474 bool startOfLine = false 4475 ) const; 4476 %Docstring 4477 GetVisibleLineNumber(pos, caretPosition=False, startOfLine=False) -> long 4478 4479 Given a position, returns the number of the visible line (potentially 4480 many to a paragraph), starting from zero at the start of the buffer. 4481 %End 4482 4483 virtual 4484 wxRichTextLine * GetLineForVisibleLineNumber( 4485 long lineNumber 4486 ) const; 4487 %Docstring 4488 GetLineForVisibleLineNumber(lineNumber) -> RichTextLine 4489 4490 Given a line number, returns the corresponding wxRichTextLine object. 4491 %End 4492 4493 virtual 4494 wxRichTextObject * GetLeafObjectAtPosition( 4495 long position 4496 ) const; 4497 %Docstring 4498 GetLeafObjectAtPosition(position) -> RichTextObject 4499 4500 Returns the leaf object in a paragraph at this position. 4501 %End 4502 4503 virtual 4504 wxRichTextParagraph * GetParagraphAtLine( 4505 long paragraphNumber 4506 ) const; 4507 %Docstring 4508 GetParagraphAtLine(paragraphNumber) -> RichTextParagraph 4509 4510 Returns the paragraph by number. 4511 %End 4512 4513 virtual 4514 wxRichTextParagraph * GetParagraphForLine( 4515 wxRichTextLine * line 4516 ) const; 4517 %Docstring 4518 GetParagraphForLine(line) -> RichTextParagraph 4519 4520 Returns the paragraph for a given line. 4521 %End 4522 4523 virtual 4524 int GetParagraphLength( 4525 long paragraphNumber 4526 ) const; 4527 %Docstring 4528 GetParagraphLength(paragraphNumber) -> int 4529 4530 Returns the length of the paragraph. 4531 %End 4532 4533 virtual 4534 int GetParagraphCount() const; 4535 %Docstring 4536 GetParagraphCount() -> int 4537 4538 Returns the number of paragraphs. 4539 %End 4540 4541 virtual 4542 int GetLineCount() const; 4543 %Docstring 4544 GetLineCount() -> int 4545 4546 Returns the number of visible lines. 4547 %End 4548 4549 virtual 4550 wxString GetParagraphText( 4551 long paragraphNumber 4552 ) const; 4553 %Docstring 4554 GetParagraphText(paragraphNumber) -> String 4555 4556 Returns the text of the paragraph. 4557 %End 4558 4559 virtual 4560 long XYToPosition( 4561 long x, 4562 long y 4563 ) const; 4564 %Docstring 4565 XYToPosition(x, y) -> long 4566 4567 Converts zero-based line column and paragraph number to a position. 4568 %End 4569 4570 virtual 4571 bool PositionToXY( 4572 long pos, 4573 long * x, 4574 long * y 4575 ) const; 4576 %Docstring 4577 PositionToXY(pos, x, y) -> bool 4578 4579 Converts a zero-based position to line column and paragraph number. 4580 %End 4581 4582 virtual 4583 bool SetStyle( 4584 const wxRichTextRange & range, 4585 const wxRichTextAttr & style, 4586 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO 4587 ); 4588 %Docstring 4589 SetStyle(range, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool 4590 SetStyle(obj, textAttr, flags=RICHTEXT_SETSTYLE_WITH_UNDO) 4591 4592 Sets the attributes for the given range. 4593 %End 4594 4595 virtual 4596 void SetStyle( 4597 wxRichTextObject * obj, 4598 const wxRichTextAttr & textAttr, 4599 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO 4600 ); 4601 4602 virtual 4603 bool GetStyle( 4604 long position, 4605 wxRichTextAttr & style 4606 ); 4607 %Docstring 4608 GetStyle(position, style) -> bool 4609 4610 Returns the combined text attributes for this position. 4611 %End 4612 4613 virtual 4614 bool GetUncombinedStyle( 4615 long position, 4616 wxRichTextAttr & style 4617 ); 4618 %Docstring 4619 GetUncombinedStyle(position, style) -> bool 4620 4621 Returns the content (uncombined) attributes for this position. 4622 %End 4623 4624 virtual 4625 bool DoGetStyle( 4626 long position, 4627 wxRichTextAttr & style, 4628 bool combineStyles = true 4629 ); 4630 %Docstring 4631 DoGetStyle(position, style, combineStyles=True) -> bool 4632 4633 Implementation helper for GetStyle. 4634 %End 4635 4636 virtual 4637 bool GetStyleForRange( 4638 const wxRichTextRange & range, 4639 wxRichTextAttr & style 4640 ); 4641 %Docstring 4642 GetStyleForRange(range, style) -> bool 4643 4644 This function gets a style representing the common, combined 4645 attributes in the given range. 4646 %End 4647 4648 bool CollectStyle( 4649 wxRichTextAttr & currentStyle, 4650 const wxRichTextAttr & style, 4651 wxRichTextAttr & clashingAttr, 4652 wxRichTextAttr & absentAttr 4653 ); 4654 %Docstring 4655 CollectStyle(currentStyle, style, clashingAttr, absentAttr) -> bool 4656 4657 Combines style with currentStyle for the purpose of summarising the 4658 attributes of a range of content. 4659 %End 4660 4661 virtual 4662 bool ClearListStyle( 4663 const wxRichTextRange & range, 4664 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO 4665 ); 4666 %Docstring 4667 ClearListStyle(range, flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool 4668 4669 Clears the list style from the given range, clearing list-related 4670 attributes and applying any named paragraph style associated with each 4671 paragraph. 4672 %End 4673 4674 virtual 4675 bool DoNumberList( 4676 const wxRichTextRange & range, 4677 const wxRichTextRange & promotionRange, 4678 int promoteBy, 4679 wxRichTextListStyleDefinition * styleDef, 4680 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, 4681 int startFrom = 1, 4682 int specifiedLevel = -1 4683 ); 4684 %Docstring 4685 DoNumberList(range, promotionRange, promoteBy, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool 4686 4687 Helper for NumberList and PromoteList, that does renumbering and 4688 promotion simultaneously def can be NULL/empty to indicate that the 4689 existing list style should be used. 4690 %End 4691 4692 virtual 4693 bool FindNextParagraphNumber( 4694 wxRichTextParagraph * previousParagraph, 4695 wxRichTextAttr & attr 4696 ) const; 4697 %Docstring 4698 FindNextParagraphNumber(previousParagraph, attr) -> bool 4699 4700 Fills in the attributes for numbering a paragraph after 4701 previousParagraph. 4702 %End 4703 4704 virtual 4705 bool SetProperties( 4706 const wxRichTextRange & range, 4707 const wxRichTextProperties & properties, 4708 int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO 4709 ); 4710 %Docstring 4711 SetProperties(range, properties, flags=RICHTEXT_SETPROPERTIES_WITH_UNDO) -> bool 4712 4713 Sets the properties for the given range, passing flags to determine 4714 how the attributes are set. 4715 %End 4716 4717 virtual 4718 bool SetObjectPropertiesWithUndo( 4719 wxRichTextObject & obj, 4720 const wxRichTextProperties & properties, 4721 wxRichTextObject * objToSet = NULL 4722 ); 4723 %Docstring 4724 SetObjectPropertiesWithUndo(obj, properties, objToSet=None) -> bool 4725 4726 Sets with undo the properties for the given object. 4727 %End 4728 4729 virtual 4730 bool HasCharacterAttributes( 4731 const wxRichTextRange & range, 4732 const wxRichTextAttr & style 4733 ) const; 4734 %Docstring 4735 HasCharacterAttributes(range, style) -> bool 4736 4737 Test if this whole range has character attributes of the specified 4738 kind. 4739 %End 4740 4741 virtual 4742 bool HasParagraphAttributes( 4743 const wxRichTextRange & range, 4744 const wxRichTextAttr & style 4745 ) const; 4746 %Docstring 4747 HasParagraphAttributes(range, style) -> bool 4748 4749 Test if this whole range has paragraph attributes of the specified 4750 kind. 4751 %End 4752 4753 virtual 4754 wxRichTextObject * Clone() const /Factory/; 4755 %Docstring 4756 Clone() -> RichTextObject 4757 4758 Clones the object. 4759 %End 4760 4761 virtual 4762 void PrepareContent( 4763 wxRichTextParagraphLayoutBox & container 4764 ); 4765 %Docstring 4766 PrepareContent(container) 4767 4768 Prepares the content just before insertion (or after buffer reset). 4769 %End 4770 4771 virtual 4772 bool InsertFragment( 4773 long position, 4774 wxRichTextParagraphLayoutBox & fragment 4775 ); 4776 %Docstring 4777 InsertFragment(position, fragment) -> bool 4778 4779 Insert fragment into this box at the given position. 4780 %End 4781 4782 virtual 4783 bool CopyFragment( 4784 const wxRichTextRange & range, 4785 wxRichTextParagraphLayoutBox & fragment 4786 ); 4787 %Docstring 4788 CopyFragment(range, fragment) -> bool 4789 4790 Make a copy of the fragment corresponding to the given range, putting 4791 it in fragment. 4792 %End 4793 4794 virtual 4795 bool ApplyStyleSheet( 4796 wxRichTextStyleSheet * styleSheet 4797 ); 4798 %Docstring 4799 ApplyStyleSheet(styleSheet) -> bool 4800 4801 Apply the style sheet to the buffer, for example if the styles have 4802 changed. 4803 %End 4804 4805 void Copy( 4806 const wxRichTextParagraphLayoutBox & obj 4807 ); 4808 %Docstring 4809 Copy(obj) 4810 %End 4811 4812 virtual 4813 void UpdateRanges(); 4814 %Docstring 4815 UpdateRanges() 4816 4817 Calculate ranges. 4818 %End 4819 4820 virtual 4821 wxString GetText() const; 4822 %Docstring 4823 GetText() -> String 4824 4825 Get all the text. 4826 %End 4827 4828 virtual 4829 bool SetDefaultStyle( 4830 const wxRichTextAttr & style 4831 ); 4832 %Docstring 4833 SetDefaultStyle(style) -> bool 4834 4835 Sets the default style, affecting the style currently being applied 4836 (for example, setting the default style to bold will cause 4837 subsequently inserted text to be bold). 4838 %End 4839 4840 virtual 4841 const wxRichTextAttr & GetDefaultStyle() const; 4842 %Docstring 4843 GetDefaultStyle() -> RichTextAttr 4844 4845 Returns the current default style, affecting the style currently being 4846 applied (for example, setting the default style to bold will cause 4847 subsequently inserted text to be bold). 4848 %End 4849 4850 virtual 4851 void SetBasicStyle( 4852 const wxRichTextAttr & style 4853 ); 4854 %Docstring 4855 SetBasicStyle(style) 4856 4857 Sets the basic (overall) style. 4858 %End 4859 4860 virtual 4861 const wxRichTextAttr & GetBasicStyle() const; 4862 %Docstring 4863 GetBasicStyle() -> RichTextAttr 4864 4865 Returns the basic (overall) style. 4866 %End 4867 4868 virtual 4869 void Invalidate( 4870 const wxRichTextRange & invalidRange = wxRICHTEXT_ALL 4871 ); 4872 %Docstring 4873 Invalidate(invalidRange=RICHTEXT_ALL) 4874 4875 Invalidates the buffer. 4876 %End 4877 4878 virtual 4879 void DoInvalidate( 4880 const wxRichTextRange & invalidRange 4881 ); 4882 %Docstring 4883 DoInvalidate(invalidRange) 4884 4885 Do the (in)validation for this object only. 4886 %End 4887 4888 virtual 4889 void InvalidateHierarchy( 4890 const wxRichTextRange & invalidRange = wxRICHTEXT_ALL 4891 ); 4892 %Docstring 4893 InvalidateHierarchy(invalidRange=RICHTEXT_ALL) 4894 4895 Do the (in)validation both up and down the hierarchy. 4896 %End 4897 4898 virtual 4899 bool UpdateFloatingObjects( 4900 const wxRect & availableRect, 4901 wxRichTextObject * untilObj = NULL 4902 ); 4903 %Docstring 4904 UpdateFloatingObjects(availableRect, untilObj=None) -> bool 4905 4906 Gather information about floating objects. 4907 %End 4908 4909 wxRichTextRange GetInvalidRange( 4910 bool wholeParagraphs = false 4911 ) const; 4912 %Docstring 4913 GetInvalidRange(wholeParagraphs=False) -> RichTextRange 4914 4915 Get invalid range, rounding to entire paragraphs if argument is true. 4916 %End 4917 4918 bool IsDirty() const; 4919 %Docstring 4920 IsDirty() -> bool 4921 4922 Returns true if this object needs layout. 4923 %End 4924 4925 wxRichTextFloatCollector * GetFloatCollector(); 4926 %Docstring 4927 GetFloatCollector() -> RichTextFloatCollector 4928 4929 Returns the wxRichTextFloatCollector of this object. 4930 %End 4931 4932 int GetFloatingObjectCount() const; 4933 %Docstring 4934 GetFloatingObjectCount() -> int 4935 4936 Returns the number of floating objects at this level. 4937 %End 4938 4939 bool GetFloatingObjects( 4940 wxRichTextObjectList & objects 4941 ) const; 4942 %Docstring 4943 GetFloatingObjects(objects) -> bool 4944 4945 Returns a list of floating objects. 4946 %End 4947 4948 public: 4949 4950 4951 %Property(name=BasicStyle, get=GetBasicStyle, set=SetBasicStyle) 4952 %Property(name=DefaultStyle, get=GetDefaultStyle, set=SetDefaultStyle) 4953 %Property(name=FloatCollector, get=GetFloatCollector) 4954 %Property(name=FloatingObjectCount, get=GetFloatingObjectCount) 4955 %Property(name=InvalidRange, get=GetInvalidRange) 4956 %Property(name=LineCount, get=GetLineCount) 4957 %Property(name=ParagraphCount, get=GetParagraphCount) 4958 %Property(name=PartialParagraph, get=GetPartialParagraph, set=SetPartialParagraph) 4959 %Property(name=RichTextCtrl, get=GetRichTextCtrl, set=SetRichTextCtrl) 4960 %Property(name=StyleSheet, get=GetStyleSheet) 4961 %Property(name=Text, get=GetText) 4962 %Property(name=XMLNodeName, get=GetXMLNodeName) 4963}; // end of class wxRichTextParagraphLayoutBox 4964 4965 4966class wxRichTextBox : wxRichTextParagraphLayoutBox 4967{ 4968 %Docstring 4969 RichTextBox(parent=None) 4970 RichTextBox(obj) 4971 4972 This class implements a floating or inline text box, containing 4973 paragraphs. 4974 %End 4975 %TypeHeaderCode 4976 #include <wx/richtext/richtextbuffer.h> 4977 %End 4978 4979public: 4980 wxRichTextBox( 4981 wxRichTextObject * parent = NULL 4982 ); 4983 4984 wxRichTextBox( 4985 const wxRichTextBox & obj 4986 ); 4987 4988 virtual 4989 bool Draw( 4990 wxDC & dc, 4991 wxRichTextDrawingContext & context, 4992 const wxRichTextRange & range, 4993 const wxRichTextSelection & selection, 4994 const wxRect & rect, 4995 int descent, 4996 int style 4997 ); 4998 %Docstring 4999 Draw(dc, context, range, selection, rect, descent, style) -> bool 5000 5001 Draw the item, within the given range. 5002 %End 5003 5004 virtual 5005 wxString GetXMLNodeName() const; 5006 %Docstring 5007 GetXMLNodeName() -> String 5008 5009 Returns the XML node name of this object. 5010 %End 5011 5012 virtual 5013 bool CanEditProperties() const; 5014 %Docstring 5015 CanEditProperties() -> bool 5016 5017 Returns true if we can edit the object's properties via a GUI. 5018 %End 5019 5020 virtual 5021 bool EditProperties( 5022 wxWindow * parent, 5023 wxRichTextBuffer * buffer 5024 ); 5025 %Docstring 5026 EditProperties(parent, buffer) -> bool 5027 5028 Edits the object's properties via a GUI. 5029 %End 5030 5031 virtual 5032 wxString GetPropertiesMenuLabel() const; 5033 %Docstring 5034 GetPropertiesMenuLabel() -> String 5035 5036 Returns the label to be used for the properties context menu item. 5037 %End 5038 5039 virtual 5040 wxRichTextObject * Clone() const /Factory/; 5041 %Docstring 5042 Clone() -> RichTextObject 5043 5044 Clones the object. 5045 %End 5046 5047 void Copy( 5048 const wxRichTextBox & obj 5049 ); 5050 %Docstring 5051 Copy(obj) 5052 %End 5053 5054 virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, 5055 const wxRect& rect, const wxRect& parentRect, 5056 int style); 5057 5058 5059 virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, 5060 int& descent, 5061 wxDC& dc, wxRichTextDrawingContext& context, int flags, 5062 const wxPoint& position = wxPoint(0,0), 5063 const wxSize& parentSize = wxDefaultSize, 5064 wxArrayInt* partialExtents = NULL) const; 5065 5066 5067 public: 5068 5069 5070 %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel) 5071 %Property(name=XMLNodeName, get=GetXMLNodeName) 5072}; // end of class wxRichTextBox 5073 5074 5075class wxRichTextField : wxRichTextParagraphLayoutBox 5076{ 5077 %Docstring 5078 RichTextField(fieldType=wx.EmptyString, parent=None) 5079 RichTextField(obj) 5080 5081 This class implements the general concept of a field, an object that 5082 represents additional functionality such as a footnote, a bookmark, a 5083 page number, a table of contents, and so on. 5084 %End 5085 %TypeHeaderCode 5086 #include <wx/richtext/richtextbuffer.h> 5087 %End 5088 5089public: 5090 wxRichTextField( 5091 const wxString & fieldType = wxEmptyString, 5092 wxRichTextObject * parent = NULL 5093 ); 5094 5095 wxRichTextField( 5096 const wxRichTextField & obj 5097 ); 5098 5099 virtual 5100 bool Draw( 5101 wxDC & dc, 5102 wxRichTextDrawingContext & context, 5103 const wxRichTextRange & range, 5104 const wxRichTextSelection & selection, 5105 const wxRect & rect, 5106 int descent, 5107 int style 5108 ); 5109 %Docstring 5110 Draw(dc, context, range, selection, rect, descent, style) -> bool 5111 5112 Draw the item, within the given range. 5113 %End 5114 5115 virtual 5116 bool Layout( 5117 wxDC & dc, 5118 wxRichTextDrawingContext & context, 5119 const wxRect & rect, 5120 const wxRect & parentRect, 5121 int style 5122 ); 5123 %Docstring 5124 Layout(dc, context, rect, parentRect, style) -> bool 5125 5126 Lay the item out at the specified position with the given size 5127 constraint. 5128 %End 5129 5130 virtual 5131 bool GetRangeSize( 5132 const wxRichTextRange & range, 5133 wxSize & size, 5134 int & descent, 5135 wxDC & dc, 5136 wxRichTextDrawingContext & context, 5137 int flags, 5138 const wxPoint & position = wxPoint(0, 0), 5139 const wxSize & parentSize = wxDefaultSize, 5140 wxArrayInt * partialExtents = NULL 5141 ) const; 5142 %Docstring 5143 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 5144 5145 Returns the object size for the given range. 5146 %End 5147 5148 virtual 5149 wxString GetXMLNodeName() const; 5150 %Docstring 5151 GetXMLNodeName() -> String 5152 5153 Returns the XML node name of this object. 5154 %End 5155 5156 virtual 5157 bool CanEditProperties() const; 5158 %Docstring 5159 CanEditProperties() -> bool 5160 5161 Returns true if we can edit the object's properties via a GUI. 5162 %End 5163 5164 virtual 5165 bool EditProperties( 5166 wxWindow * parent, 5167 wxRichTextBuffer * buffer 5168 ); 5169 %Docstring 5170 EditProperties(parent, buffer) -> bool 5171 5172 Edits the object's properties via a GUI. 5173 %End 5174 5175 virtual 5176 wxString GetPropertiesMenuLabel() const; 5177 %Docstring 5178 GetPropertiesMenuLabel() -> String 5179 5180 Returns the label to be used for the properties context menu item. 5181 %End 5182 5183 virtual 5184 bool AcceptsFocus() const; 5185 %Docstring 5186 AcceptsFocus() -> bool 5187 5188 Returns true if objects of this class can accept the focus, i.e. a 5189 call to SetFocusObject is possible. 5190 %End 5191 5192 virtual 5193 void CalculateRange( 5194 long start, 5195 long & end /Out/ 5196 ); 5197 %Docstring 5198 CalculateRange(start) -> end 5199 5200 Calculates the range of the object. 5201 %End 5202 5203 virtual 5204 bool IsAtomic() const; 5205 %Docstring 5206 IsAtomic() -> bool 5207 5208 If a field has children, we don't want the user to be able to edit it. 5209 %End 5210 5211 virtual 5212 bool IsEmpty() const; 5213 %Docstring 5214 IsEmpty() -> bool 5215 5216 Returns true if the buffer is empty. 5217 %End 5218 5219 virtual 5220 bool IsTopLevel() const; 5221 %Docstring 5222 IsTopLevel() -> bool 5223 5224 Returns true if this object is top-level, i.e. contains its own 5225 paragraphs, such as a text box. 5226 %End 5227 5228 void SetFieldType( 5229 const wxString & fieldType 5230 ); 5231 %Docstring 5232 SetFieldType(fieldType) 5233 %End 5234 5235 wxString GetFieldType() const; 5236 %Docstring 5237 GetFieldType() -> String 5238 %End 5239 5240 virtual 5241 bool UpdateField( 5242 wxRichTextBuffer * buffer 5243 ); 5244 %Docstring 5245 UpdateField(buffer) -> bool 5246 5247 Update the field; delegated to the associated field type. 5248 %End 5249 5250 virtual 5251 wxRichTextObject * Clone() const /Factory/; 5252 %Docstring 5253 Clone() -> RichTextObject 5254 5255 Clones the object. 5256 %End 5257 5258 void Copy( 5259 const wxRichTextField & obj 5260 ); 5261 %Docstring 5262 Copy(obj) 5263 %End 5264 5265 public: 5266 5267 5268 %Property(name=FieldType, get=GetFieldType, set=SetFieldType) 5269 %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel) 5270 %Property(name=XMLNodeName, get=GetXMLNodeName) 5271}; // end of class wxRichTextField 5272 5273 5274class wxRichTextFieldType : wxObject 5275{ 5276 %Docstring 5277 RichTextFieldType(name=wx.EmptyString) 5278 RichTextFieldType(fieldType) 5279 5280 The base class for custom field types. 5281 %End 5282 %TypeHeaderCode 5283 #include <wx/richtext/richtextbuffer.h> 5284 %End 5285 5286public: 5287 wxRichTextFieldType( 5288 const wxString & name = wxEmptyString 5289 ); 5290 5291 wxRichTextFieldType( 5292 const wxRichTextFieldType & fieldType 5293 ); 5294 5295 void Copy( 5296 const wxRichTextFieldType & fieldType 5297 ); 5298 %Docstring 5299 Copy(fieldType) 5300 %End 5301 5302 virtual 5303 bool Draw( 5304 wxRichTextField * obj, 5305 wxDC & dc, 5306 wxRichTextDrawingContext & context, 5307 const wxRichTextRange & range, 5308 const wxRichTextSelection & selection, 5309 const wxRect & rect, 5310 int descent, 5311 int style 5312 ) = 0; 5313 %Docstring 5314 Draw(obj, dc, context, range, selection, rect, descent, style) -> bool 5315 5316 Draw the item, within the given range. 5317 %End 5318 5319 virtual 5320 bool Layout( 5321 wxRichTextField * obj, 5322 wxDC & dc, 5323 wxRichTextDrawingContext & context, 5324 const wxRect & rect, 5325 const wxRect & parentRect, 5326 int style 5327 ) = 0; 5328 %Docstring 5329 Layout(obj, dc, context, rect, parentRect, style) -> bool 5330 5331 Lay the item out at the specified position with the given size 5332 constraint. 5333 %End 5334 5335 virtual 5336 bool GetRangeSize( 5337 wxRichTextField * obj, 5338 const wxRichTextRange & range, 5339 wxSize & size, 5340 int & descent, 5341 wxDC & dc, 5342 wxRichTextDrawingContext & context, 5343 int flags, 5344 const wxPoint & position = wxPoint(0, 0), 5345 const wxSize & parentSize = wxDefaultSize, 5346 wxArrayInt * partialExtents = NULL 5347 ) const = 0; 5348 %Docstring 5349 GetRangeSize(obj, range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 5350 5351 Returns the object size for the given range. 5352 %End 5353 5354 virtual 5355 bool CanEditProperties( 5356 wxRichTextField * obj 5357 ) const; 5358 %Docstring 5359 CanEditProperties(obj) -> bool 5360 5361 Returns true if we can edit the object's properties via a GUI. 5362 %End 5363 5364 virtual 5365 bool EditProperties( 5366 wxRichTextField * obj, 5367 wxWindow * parent, 5368 wxRichTextBuffer * buffer 5369 ); 5370 %Docstring 5371 EditProperties(obj, parent, buffer) -> bool 5372 5373 Edits the object's properties via a GUI. 5374 %End 5375 5376 virtual 5377 wxString GetPropertiesMenuLabel( 5378 wxRichTextField * obj 5379 ) const; 5380 %Docstring 5381 GetPropertiesMenuLabel(obj) -> String 5382 5383 Returns the label to be used for the properties context menu item. 5384 %End 5385 5386 virtual 5387 bool UpdateField( 5388 wxRichTextBuffer * buffer, 5389 wxRichTextField * obj 5390 ); 5391 %Docstring 5392 UpdateField(buffer, obj) -> bool 5393 5394 Update the field. 5395 %End 5396 5397 virtual 5398 bool IsTopLevel( 5399 wxRichTextField * obj 5400 ) const; 5401 %Docstring 5402 IsTopLevel(obj) -> bool 5403 5404 Returns true if this object is top-level, i.e. contains its own 5405 paragraphs, such as a text box. 5406 %End 5407 5408 void SetName( 5409 const wxString & name 5410 ); 5411 %Docstring 5412 SetName(name) 5413 5414 Sets the field type name. 5415 %End 5416 5417 wxString GetName() const; 5418 %Docstring 5419 GetName() -> String 5420 5421 Returns the field type name. 5422 %End 5423 5424 public: 5425 5426 5427 %Property(name=Name, get=GetName, set=SetName) 5428}; // end of class wxRichTextFieldType 5429 5430 5431class wxRichTextFieldTypeStandard : wxRichTextFieldType 5432{ 5433 %Docstring 5434 RichTextFieldTypeStandard(name, label, displayStyle=RICHTEXT_FIELD_STYLE_RECTANGLE) 5435 RichTextFieldTypeStandard(name, bitmap, displayStyle=RICHTEXT_FIELD_STYLE_NO_BORDER) 5436 RichTextFieldTypeStandard() 5437 RichTextFieldTypeStandard(field) 5438 5439 A field type that can handle fields with text or bitmap labels, with a 5440 small range of styles for implementing rectangular fields and fields 5441 that can be used for start and end tags. 5442 %End 5443 %TypeHeaderCode 5444 #include <wx/richtext/richtextbuffer.h> 5445 %End 5446 5447public: 5448 enum 5449 { 5450 wxRICHTEXT_FIELD_STYLE_COMPOSITE, 5451 wxRICHTEXT_FIELD_STYLE_RECTANGLE, 5452 wxRICHTEXT_FIELD_STYLE_NO_BORDER, 5453 wxRICHTEXT_FIELD_STYLE_START_TAG, 5454 wxRICHTEXT_FIELD_STYLE_END_TAG 5455 }; 5456 5457 wxRichTextFieldTypeStandard( 5458 const wxString & name, 5459 const wxString & label, 5460 int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE 5461 ); 5462 5463 wxRichTextFieldTypeStandard( 5464 const wxString & name, 5465 const wxBitmap & bitmap, 5466 int displayStyle = wxRICHTEXT_FIELD_STYLE_NO_BORDER 5467 ); 5468 5469 wxRichTextFieldTypeStandard(); 5470 5471 wxRichTextFieldTypeStandard( 5472 const wxRichTextFieldTypeStandard & field 5473 ); 5474 5475 void Init(); 5476 %Docstring 5477 Init() 5478 5479 Initialises the object. 5480 %End 5481 5482 void Copy( 5483 const wxRichTextFieldTypeStandard & field 5484 ); 5485 %Docstring 5486 Copy(field) 5487 5488 Copies the object. 5489 %End 5490 5491 virtual 5492 bool Draw( 5493 wxRichTextField * obj, 5494 wxDC & dc, 5495 wxRichTextDrawingContext & context, 5496 const wxRichTextRange & range, 5497 const wxRichTextSelection & selection, 5498 const wxRect & rect, 5499 int descent, 5500 int style 5501 ); 5502 %Docstring 5503 Draw(obj, dc, context, range, selection, rect, descent, style) -> bool 5504 5505 Draw the item, within the given range. 5506 %End 5507 5508 virtual 5509 bool Layout( 5510 wxRichTextField * obj, 5511 wxDC & dc, 5512 wxRichTextDrawingContext & context, 5513 const wxRect & rect, 5514 const wxRect & parentRect, 5515 int style 5516 ); 5517 %Docstring 5518 Layout(obj, dc, context, rect, parentRect, style) -> bool 5519 5520 Lay the item out at the specified position with the given size 5521 constraint. 5522 %End 5523 5524 virtual 5525 bool GetRangeSize( 5526 wxRichTextField * obj, 5527 const wxRichTextRange & range, 5528 wxSize & size, 5529 int & descent, 5530 wxDC & dc, 5531 wxRichTextDrawingContext & context, 5532 int flags, 5533 const wxPoint & position = wxPoint(0, 0), 5534 const wxSize & parentSize = wxDefaultSize, 5535 wxArrayInt * partialExtents = NULL 5536 ) const; 5537 %Docstring 5538 GetRangeSize(obj, range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 5539 5540 Returns the object size for the given range. 5541 %End 5542 5543 wxSize GetSize( 5544 wxRichTextField * obj, 5545 wxDC & dc, 5546 wxRichTextDrawingContext & context, 5547 int style 5548 ) const; 5549 %Docstring 5550 GetSize(obj, dc, context, style) -> wx.Size 5551 5552 Get the size of the field, given the label, font size, and so on. 5553 %End 5554 5555 virtual 5556 bool IsTopLevel( 5557 wxRichTextField * obj 5558 ) const; 5559 %Docstring 5560 IsTopLevel(obj) -> bool 5561 5562 Returns true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE, 5563 false otherwise. 5564 %End 5565 5566 void SetLabel( 5567 const wxString & label 5568 ); 5569 %Docstring 5570 SetLabel(label) 5571 5572 Sets the text label for fields of this type. 5573 %End 5574 5575 const wxString & GetLabel() const; 5576 %Docstring 5577 GetLabel() -> String 5578 5579 Returns the text label for fields of this type. 5580 %End 5581 5582 void SetBitmap( 5583 const wxBitmap & bitmap 5584 ); 5585 %Docstring 5586 SetBitmap(bitmap) 5587 5588 Sets the bitmap label for fields of this type. 5589 %End 5590 5591 const wxBitmap & GetBitmap() const; 5592 %Docstring 5593 GetBitmap() -> wx.Bitmap 5594 5595 Gets the bitmap label for fields of this type. 5596 %End 5597 5598 int GetDisplayStyle() const; 5599 %Docstring 5600 GetDisplayStyle() -> int 5601 5602 Gets the display style for fields of this type. 5603 %End 5604 5605 void SetDisplayStyle( 5606 int displayStyle 5607 ); 5608 %Docstring 5609 SetDisplayStyle(displayStyle) 5610 5611 Sets the display style for fields of this type. 5612 %End 5613 5614 const wxFont & GetFont() const; 5615 %Docstring 5616 GetFont() -> wx.Font 5617 5618 Gets the font used for drawing the text label. 5619 %End 5620 5621 void SetFont( 5622 const wxFont & font 5623 ); 5624 %Docstring 5625 SetFont(font) 5626 5627 Sets the font used for drawing the text label. 5628 %End 5629 5630 const wxColour & GetTextColour() const; 5631 %Docstring 5632 GetTextColour() -> wx.Colour 5633 5634 Gets the colour used for drawing the text label. 5635 %End 5636 5637 void SetTextColour( 5638 const wxColour & colour 5639 ); 5640 %Docstring 5641 SetTextColour(colour) 5642 5643 Sets the colour used for drawing the text label. 5644 %End 5645 5646 const wxColour & GetBorderColour() const; 5647 %Docstring 5648 GetBorderColour() -> wx.Colour 5649 5650 Gets the colour used for drawing the field border. 5651 %End 5652 5653 void SetBorderColour( 5654 const wxColour & colour 5655 ); 5656 %Docstring 5657 SetBorderColour(colour) 5658 5659 Sets the colour used for drawing the field border. 5660 %End 5661 5662 const wxColour & GetBackgroundColour() const; 5663 %Docstring 5664 GetBackgroundColour() -> wx.Colour 5665 5666 Gets the colour used for drawing the field background. 5667 %End 5668 5669 void SetBackgroundColour( 5670 const wxColour & colour 5671 ); 5672 %Docstring 5673 SetBackgroundColour(colour) 5674 5675 Sets the colour used for drawing the field background. 5676 %End 5677 5678 void SetVerticalPadding( 5679 int padding 5680 ); 5681 %Docstring 5682 SetVerticalPadding(padding) 5683 5684 Sets the vertical padding (the distance between the border and the 5685 text). 5686 %End 5687 5688 int GetVerticalPadding() const; 5689 %Docstring 5690 GetVerticalPadding() -> int 5691 5692 Gets the vertical padding (the distance between the border and the 5693 text). 5694 %End 5695 5696 void SetHorizontalPadding( 5697 int padding 5698 ); 5699 %Docstring 5700 SetHorizontalPadding(padding) 5701 5702 Sets the horizontal padding (the distance between the border and the 5703 text). 5704 %End 5705 5706 int GetHorizontalPadding() const; 5707 %Docstring 5708 GetHorizontalPadding() -> int 5709 5710 Sets the horizontal padding (the distance between the border and the 5711 text). 5712 %End 5713 5714 void SetHorizontalMargin( 5715 int margin 5716 ); 5717 %Docstring 5718 SetHorizontalMargin(margin) 5719 5720 Sets the horizontal margin surrounding the field object. 5721 %End 5722 5723 int GetHorizontalMargin() const; 5724 %Docstring 5725 GetHorizontalMargin() -> int 5726 5727 Gets the horizontal margin surrounding the field object. 5728 %End 5729 5730 void SetVerticalMargin( 5731 int margin 5732 ); 5733 %Docstring 5734 SetVerticalMargin(margin) 5735 5736 Sets the vertical margin surrounding the field object. 5737 %End 5738 5739 int GetVerticalMargin() const; 5740 %Docstring 5741 GetVerticalMargin() -> int 5742 5743 Gets the vertical margin surrounding the field object. 5744 %End 5745 5746 public: 5747 5748 5749 %Property(name=BackgroundColour, get=GetBackgroundColour, set=SetBackgroundColour) 5750 %Property(name=Bitmap, get=GetBitmap, set=SetBitmap) 5751 %Property(name=BorderColour, get=GetBorderColour, set=SetBorderColour) 5752 %Property(name=DisplayStyle, get=GetDisplayStyle, set=SetDisplayStyle) 5753 %Property(name=Font, get=GetFont, set=SetFont) 5754 %Property(name=HorizontalMargin, get=GetHorizontalMargin, set=SetHorizontalMargin) 5755 %Property(name=HorizontalPadding, get=GetHorizontalPadding, set=SetHorizontalPadding) 5756 %Property(name=Label, get=GetLabel, set=SetLabel) 5757 %Property(name=TextColour, get=GetTextColour, set=SetTextColour) 5758 %Property(name=VerticalMargin, get=GetVerticalMargin, set=SetVerticalMargin) 5759 %Property(name=VerticalPadding, get=GetVerticalPadding, set=SetVerticalPadding) 5760}; // end of class wxRichTextFieldTypeStandard 5761 5762 5763class wxRichTextLine 5764{ 5765 %Docstring 5766 RichTextLine(parent) 5767 RichTextLine(obj) 5768 5769 This object represents a line in a paragraph, and stores offsets from 5770 the start of the paragraph representing the start and end positions of 5771 the line. 5772 %End 5773 %TypeHeaderCode 5774 #include <wx/richtext/richtextbuffer.h> 5775 %End 5776 5777public: 5778 wxRichTextLine( 5779 wxRichTextParagraph * parent 5780 ); 5781 5782 wxRichTextLine( 5783 const wxRichTextLine & obj 5784 ); 5785 5786 virtual 5787 ~wxRichTextLine(); 5788 5789 void SetRange( 5790 const wxRichTextRange & range 5791 ); 5792 %Docstring 5793 SetRange(range) 5794 SetRange(from_, to_) 5795 5796 Sets the range associated with this line. 5797 %End 5798 5799 void SetRange( 5800 long from_, 5801 long to_ 5802 ); 5803 5804 wxRichTextParagraph * GetParent(); 5805 %Docstring 5806 GetParent() -> RichTextParagraph 5807 5808 Returns the parent paragraph. 5809 %End 5810 5811 wxRichTextRange & GetRange(); 5812 %Docstring 5813 GetRange() -> RichTextRange 5814 5815 Returns the range. 5816 %End 5817 5818 wxRichTextRange GetAbsoluteRange() const; 5819 %Docstring 5820 GetAbsoluteRange() -> RichTextRange 5821 5822 Returns the absolute range. 5823 %End 5824 5825 virtual 5826 wxSize GetSize() const; 5827 %Docstring 5828 GetSize() -> wx.Size 5829 5830 Returns the line size as calculated by Layout. 5831 %End 5832 5833 virtual 5834 void SetSize( 5835 const wxSize & sz 5836 ); 5837 %Docstring 5838 SetSize(sz) 5839 5840 Sets the line size as calculated by Layout. 5841 %End 5842 5843 virtual 5844 wxPoint GetPosition() const; 5845 %Docstring 5846 GetPosition() -> wx.Point 5847 5848 Returns the object position relative to the parent. 5849 %End 5850 5851 virtual 5852 void SetPosition( 5853 const wxPoint & pos 5854 ); 5855 %Docstring 5856 SetPosition(pos) 5857 5858 Sets the object position relative to the parent. 5859 %End 5860 5861 virtual 5862 wxPoint GetAbsolutePosition() const; 5863 %Docstring 5864 GetAbsolutePosition() -> wx.Point 5865 5866 Returns the absolute object position. 5867 %End 5868 5869 virtual 5870 wxRect GetRect() const; 5871 %Docstring 5872 GetRect() -> wx.Rect 5873 5874 Returns the rectangle enclosing the line. 5875 %End 5876 5877 void SetDescent( 5878 int descent 5879 ); 5880 %Docstring 5881 SetDescent(descent) 5882 5883 Sets the stored descent. 5884 %End 5885 5886 int GetDescent() const; 5887 %Docstring 5888 GetDescent() -> int 5889 5890 Returns the stored descent. 5891 %End 5892 5893 void Init( 5894 wxRichTextParagraph * parent 5895 ); 5896 %Docstring 5897 Init(parent) 5898 5899 Initialises the object. 5900 %End 5901 5902 void Copy( 5903 const wxRichTextLine & obj 5904 ); 5905 %Docstring 5906 Copy(obj) 5907 5908 Copies from obj. 5909 %End 5910 5911 virtual 5912 wxRichTextLine * Clone() const /Factory/; 5913 %Docstring 5914 Clone() -> RichTextLine 5915 %End 5916 5917 public: 5918 5919 5920 %Property(name=AbsolutePosition, get=GetAbsolutePosition) 5921 %Property(name=AbsoluteRange, get=GetAbsoluteRange) 5922 %Property(name=Descent, get=GetDescent, set=SetDescent) 5923 %Property(name=Parent, get=GetParent) 5924 %Property(name=Position, get=GetPosition, set=SetPosition) 5925 %Property(name=Range, get=GetRange, set=SetRange) 5926 %Property(name=Rect, get=GetRect) 5927 %Property(name=Size, get=GetSize, set=SetSize) 5928}; // end of class wxRichTextLine 5929 5930 5931class wxRichTextParagraph : wxRichTextCompositeObject 5932{ 5933 %Docstring 5934 RichTextParagraph(parent=None, style=None) 5935 RichTextParagraph(text, parent=None, paraStyle=None, charStyle=None) 5936 RichTextParagraph(obj) 5937 5938 This object represents a single paragraph containing various objects 5939 such as text content, images, and further paragraph layout objects. 5940 %End 5941 %TypeHeaderCode 5942 #include <wx/richtext/richtextbuffer.h> 5943 %End 5944 5945public: 5946 wxRichTextParagraph( 5947 wxRichTextObject * parent = NULL, 5948 wxRichTextAttr * style = NULL 5949 ); 5950 5951 wxRichTextParagraph( 5952 const wxString & text, 5953 wxRichTextObject * parent = NULL, 5954 wxRichTextAttr * paraStyle = NULL, 5955 wxRichTextAttr * charStyle = NULL 5956 ); 5957 5958 wxRichTextParagraph( 5959 const wxRichTextParagraph & obj 5960 ); 5961 5962 virtual 5963 ~wxRichTextParagraph(); 5964 5965 virtual 5966 bool Draw( 5967 wxDC & dc, 5968 wxRichTextDrawingContext & context, 5969 const wxRichTextRange & range, 5970 const wxRichTextSelection & selection, 5971 const wxRect & rect, 5972 int descent, 5973 int style 5974 ); 5975 %Docstring 5976 Draw(dc, context, range, selection, rect, descent, style) -> bool 5977 5978 Draw the item, within the given range. 5979 %End 5980 5981 virtual 5982 bool Layout( 5983 wxDC & dc, 5984 wxRichTextDrawingContext & context, 5985 const wxRect & rect, 5986 const wxRect & parentRect, 5987 int style 5988 ); 5989 %Docstring 5990 Layout(dc, context, rect, parentRect, style) -> bool 5991 5992 Lay the item out at the specified position with the given size 5993 constraint. 5994 %End 5995 5996 virtual 5997 bool GetRangeSize( 5998 const wxRichTextRange & range, 5999 wxSize & size, 6000 int & descent, 6001 wxDC & dc, 6002 wxRichTextDrawingContext & context, 6003 int flags, 6004 const wxPoint & position = wxPoint(0, 0), 6005 const wxSize & parentSize = wxDefaultSize, 6006 wxArrayInt * partialExtents = NULL 6007 ) const; 6008 %Docstring 6009 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 6010 6011 Returns the object size for the given range. 6012 %End 6013 6014 virtual 6015 bool FindPosition( 6016 wxDC & dc, 6017 wxRichTextDrawingContext & context, 6018 long index, 6019 wxPoint & pt /Out/, 6020 int * height /Out/, 6021 bool forceLineStart 6022 ); 6023 %Docstring 6024 FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height) 6025 6026 Finds the absolute position and row height for the given character 6027 position. 6028 %End 6029 6030 virtual 6031 int HitTest( 6032 wxDC & dc, 6033 wxRichTextDrawingContext & context, 6034 const wxPoint & pt, 6035 long & textPosition /Out/, 6036 wxRichTextObject ** obj /Out/, 6037 wxRichTextObject ** contextObj /Out/, 6038 int flags = 0 6039 ); 6040 %Docstring 6041 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 6042 6043 Hit-testing: returns a flag indicating hit test details, plus 6044 information about position. 6045 %End 6046 6047 virtual 6048 void CalculateRange( 6049 long start, 6050 long & end /Out/ 6051 ); 6052 %Docstring 6053 CalculateRange(start) -> end 6054 6055 Calculates the range of the object. 6056 %End 6057 6058 virtual 6059 wxString GetXMLNodeName() const; 6060 %Docstring 6061 GetXMLNodeName() -> String 6062 6063 Returns the XML node name of this object. 6064 %End 6065 6066 wxRichTextLineList & GetLines(); 6067 %Docstring 6068 GetLines() -> RichTextLineList 6069 6070 Returns the cached lines. 6071 %End 6072 6073 void Copy( 6074 const wxRichTextParagraph & obj 6075 ); 6076 %Docstring 6077 Copy(obj) 6078 6079 Copies the object. 6080 %End 6081 6082 virtual 6083 wxRichTextObject * Clone() const /Factory/; 6084 %Docstring 6085 Clone() -> RichTextObject 6086 6087 Clones the object. 6088 %End 6089 6090 void ClearLines(); 6091 %Docstring 6092 ClearLines() 6093 6094 Clears the cached lines. 6095 %End 6096 6097 virtual 6098 void ApplyParagraphStyle( 6099 wxRichTextLine * line, 6100 const wxRichTextAttr & attr, 6101 const wxRect & rect, 6102 wxDC & dc 6103 ); 6104 %Docstring 6105 ApplyParagraphStyle(line, attr, rect, dc) 6106 6107 Applies paragraph styles such as centering to the wrapped lines. 6108 %End 6109 6110 virtual 6111 bool InsertText( 6112 long pos, 6113 const wxString & text 6114 ); 6115 %Docstring 6116 InsertText(pos, text) -> bool 6117 6118 Inserts text at the given position. 6119 %End 6120 6121 virtual 6122 wxRichTextObject * SplitAt( 6123 long pos, 6124 wxRichTextObject ** previousObject = NULL 6125 ); 6126 %Docstring 6127 SplitAt(pos, previousObject=None) -> RichTextObject 6128 6129 Splits an object at this position if necessary, and returns the 6130 previous object, or NULL if inserting at the beginning. 6131 %End 6132 6133 virtual 6134 void MoveToList( 6135 wxRichTextObject * obj, 6136 wxRichTextObjectList_& list 6137 ); 6138 %Docstring 6139 MoveToList(obj, list) 6140 6141 Moves content to a list from this point. 6142 %End 6143 6144 virtual 6145 void MoveFromList( 6146 wxRichTextObjectList_& list 6147 ); 6148 %Docstring 6149 MoveFromList(list) 6150 6151 Adds content back from a list. 6152 %End 6153 6154 bool GetContiguousPlainText( 6155 wxString & text, 6156 const wxRichTextRange & range, 6157 bool fromStart = true 6158 ); 6159 %Docstring 6160 GetContiguousPlainText(text, range, fromStart=True) -> bool 6161 6162 Returns the plain text searching from the start or end of the range. 6163 %End 6164 6165 bool FindWrapPosition( 6166 const wxRichTextRange & range, 6167 wxDC & dc, 6168 wxRichTextDrawingContext & context, 6169 int availableSpace, 6170 long & wrapPosition, 6171 wxArrayInt * partialExtents 6172 ); 6173 %Docstring 6174 FindWrapPosition(range, dc, context, availableSpace, wrapPosition, partialExtents) -> bool 6175 6176 Finds a suitable wrap position. 6177 %End 6178 6179 wxRichTextObject * FindObjectAtPosition( 6180 long position 6181 ); 6182 %Docstring 6183 FindObjectAtPosition(position) -> RichTextObject 6184 6185 Finds the object at the given position. 6186 %End 6187 6188 wxString GetBulletText(); 6189 %Docstring 6190 GetBulletText() -> String 6191 6192 Returns the bullet text for this paragraph. 6193 %End 6194 6195 wxRichTextLine * AllocateLine( 6196 int pos 6197 ); 6198 %Docstring 6199 AllocateLine(pos) -> RichTextLine 6200 6201 Allocates or reuses a line object. 6202 %End 6203 6204 bool ClearUnusedLines( 6205 int lineCount 6206 ); 6207 %Docstring 6208 ClearUnusedLines(lineCount) -> bool 6209 6210 Clears remaining unused line objects, if any. 6211 %End 6212 6213 wxRichTextAttr GetCombinedAttributes( 6214 const wxRichTextAttr & contentStyle, 6215 bool includingBoxAttr = false 6216 ) const; 6217 %Docstring 6218 GetCombinedAttributes(contentStyle, includingBoxAttr=False) -> RichTextAttr 6219 GetCombinedAttributes(includingBoxAttr=False) -> RichTextAttr 6220 6221 Returns combined attributes of the base style, paragraph style and 6222 character style. 6223 %End 6224 6225 wxRichTextAttr GetCombinedAttributes( 6226 bool includingBoxAttr = false 6227 ) const; 6228 6229 long GetFirstLineBreakPosition( 6230 long pos 6231 ); 6232 %Docstring 6233 GetFirstLineBreakPosition(pos) -> long 6234 6235 Returns the first position from pos that has a line break character. 6236 %End 6237 6238 void LayoutFloat( 6239 wxDC & dc, 6240 wxRichTextDrawingContext & context, 6241 const wxRect & rect, 6242 const wxRect & parentRect, 6243 int style, 6244 wxRichTextFloatCollector * floatCollector 6245 ); 6246 %Docstring 6247 LayoutFloat(dc, context, rect, parentRect, style, floatCollector) 6248 6249 Lays out the floating objects. 6250 %End 6251 6252 static 6253 void InitDefaultTabs(); 6254 %Docstring 6255 InitDefaultTabs() 6256 6257 Creates a default tabstop array. 6258 %End 6259 6260 static 6261 void ClearDefaultTabs(); 6262 %Docstring 6263 ClearDefaultTabs() 6264 6265 Clears the default tabstop array. 6266 %End 6267 6268 static 6269 const wxArrayInt & GetDefaultTabs(); 6270 %Docstring 6271 GetDefaultTabs() -> ArrayInt 6272 6273 Returns the default tabstop array. 6274 %End 6275 6276 public: 6277 6278 6279 %Property(name=BulletText, get=GetBulletText) 6280 %Property(name=CombinedAttributes, get=GetCombinedAttributes) 6281 %Property(name=Lines, get=GetLines) 6282 %Property(name=XMLNodeName, get=GetXMLNodeName) 6283}; // end of class wxRichTextParagraph 6284 6285 6286class wxRichTextPlainText : wxRichTextObject 6287{ 6288 %Docstring 6289 RichTextPlainText(text=wx.EmptyString, parent=None, style=None) 6290 RichTextPlainText(obj) 6291 6292 This object represents a single piece of text. 6293 %End 6294 %TypeHeaderCode 6295 #include <wx/richtext/richtextbuffer.h> 6296 %End 6297 6298public: 6299 wxRichTextPlainText( 6300 const wxString & text = wxEmptyString, 6301 wxRichTextObject * parent = NULL, 6302 wxRichTextAttr * style = NULL 6303 ); 6304 6305 wxRichTextPlainText( 6306 const wxRichTextPlainText & obj 6307 ); 6308 6309 virtual 6310 bool Draw( 6311 wxDC & dc, 6312 wxRichTextDrawingContext & context, 6313 const wxRichTextRange & range, 6314 const wxRichTextSelection & selection, 6315 const wxRect & rect, 6316 int descent, 6317 int style 6318 ); 6319 %Docstring 6320 Draw(dc, context, range, selection, rect, descent, style) -> bool 6321 6322 Draw the item, within the given range. 6323 %End 6324 6325 virtual 6326 bool Layout( 6327 wxDC & dc, 6328 wxRichTextDrawingContext & context, 6329 const wxRect & rect, 6330 const wxRect & parentRect, 6331 int style 6332 ); 6333 %Docstring 6334 Layout(dc, context, rect, parentRect, style) -> bool 6335 6336 Lay the item out at the specified position with the given size 6337 constraint. 6338 %End 6339 6340 virtual 6341 bool GetRangeSize( 6342 const wxRichTextRange & range, 6343 wxSize & size, 6344 int & descent, 6345 wxDC & dc, 6346 wxRichTextDrawingContext & context, 6347 int flags, 6348 const wxPoint & position = wxPoint(0, 0), 6349 const wxSize & parentSize = wxDefaultSize, 6350 wxArrayInt * partialExtents = NULL 6351 ) const; 6352 %Docstring 6353 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 6354 6355 Returns the object size for the given range. 6356 %End 6357 6358 virtual 6359 wxString GetTextForRange( 6360 const wxRichTextRange & range 6361 ) const; 6362 %Docstring 6363 GetTextForRange(range) -> String 6364 6365 Returns any text in this object for the given range. 6366 %End 6367 6368 virtual 6369 wxRichTextObject * DoSplit( 6370 long pos 6371 ); 6372 %Docstring 6373 DoSplit(pos) -> RichTextObject 6374 6375 Do a split from pos, returning an object containing the second part, 6376 and setting the first part in 'this'. 6377 %End 6378 6379 virtual 6380 void CalculateRange( 6381 long start, 6382 long & end /Out/ 6383 ); 6384 %Docstring 6385 CalculateRange(start) -> end 6386 6387 Calculates the range of the object. 6388 %End 6389 6390 virtual 6391 bool DeleteRange( 6392 const wxRichTextRange & range 6393 ); 6394 %Docstring 6395 DeleteRange(range) -> bool 6396 6397 Deletes the given range. 6398 %End 6399 6400 virtual 6401 bool IsEmpty() const; 6402 %Docstring 6403 IsEmpty() -> bool 6404 6405 Returns true if the object is empty. 6406 %End 6407 6408 virtual 6409 bool CanMerge( 6410 wxRichTextObject * object, 6411 wxRichTextDrawingContext & context 6412 ) const; 6413 %Docstring 6414 CanMerge(object, context) -> bool 6415 6416 Returns true if this object can merge itself with the given one. 6417 %End 6418 6419 virtual 6420 bool Merge( 6421 wxRichTextObject * object, 6422 wxRichTextDrawingContext & context 6423 ); 6424 %Docstring 6425 Merge(object, context) -> bool 6426 6427 Returns true if this object merged itself with the given one. 6428 %End 6429 6430 virtual 6431 bool CanSplit( 6432 wxRichTextDrawingContext & context 6433 ) const; 6434 %Docstring 6435 CanSplit(context) -> bool 6436 6437 Returns true if this object can potentially be split, by virtue of 6438 having different virtual attributes for individual sub-objects. 6439 %End 6440 6441 virtual 6442 wxRichTextObject * Split( 6443 wxRichTextDrawingContext & context 6444 ); 6445 %Docstring 6446 Split(context) -> RichTextObject 6447 6448 Returns the final object in the split objects if this object was split 6449 due to differences between sub-object virtual attributes. 6450 %End 6451 6452 long GetFirstLineBreakPosition( 6453 long pos 6454 ); 6455 %Docstring 6456 GetFirstLineBreakPosition(pos) -> long 6457 6458 Get the first position from pos that has a line break character. 6459 %End 6460 6461 virtual 6462 bool UsesParagraphAttributes() const; 6463 %Docstring 6464 UsesParagraphAttributes() -> bool 6465 6466 Does this object take note of paragraph attributes? Text and image 6467 objects don't. 6468 %End 6469 6470 virtual 6471 bool ImportFromXML( 6472 wxRichTextBuffer * buffer, 6473 wxXmlNode * node, 6474 wxRichTextXMLHandler * handler, 6475 bool * recurse 6476 ); 6477 %Docstring 6478 ImportFromXML(buffer, node, handler, recurse) -> bool 6479 6480 Imports this object from XML. 6481 %End 6482 6483 virtual 6484 wxString GetXMLNodeName() const; 6485 %Docstring 6486 GetXMLNodeName() -> String 6487 6488 Returns the XML node name of this object. 6489 %End 6490 6491 const wxString & GetText() const; 6492 %Docstring 6493 GetText() -> String 6494 6495 Returns the text. 6496 %End 6497 6498 void SetText( 6499 const wxString & text 6500 ); 6501 %Docstring 6502 SetText(text) 6503 6504 Sets the text. 6505 %End 6506 6507 void Copy( 6508 const wxRichTextPlainText & obj 6509 ); 6510 %Docstring 6511 Copy(obj) 6512 %End 6513 6514 virtual 6515 wxRichTextObject * Clone() const /Factory/; 6516 %Docstring 6517 Clone() -> RichTextObject 6518 6519 Clones the object. 6520 %End 6521 6522 public: 6523 6524 6525 %Property(name=Text, get=GetText, set=SetText) 6526 %Property(name=XMLNodeName, get=GetXMLNodeName) 6527}; // end of class wxRichTextPlainText 6528 6529 6530class wxRichTextImageBlock : wxObject 6531{ 6532 %Docstring 6533 RichTextImageBlock() 6534 RichTextImageBlock(block) 6535 6536 This class stores information about an image, in binary in-memory 6537 form. 6538 %End 6539 %TypeHeaderCode 6540 #include <wx/richtext/richtextbuffer.h> 6541 %End 6542 6543public: 6544 wxRichTextImageBlock(); 6545 6546 wxRichTextImageBlock( 6547 const wxRichTextImageBlock & block 6548 ); 6549 6550 virtual 6551 ~wxRichTextImageBlock(); 6552 6553 void Init(); 6554 %Docstring 6555 Init() 6556 6557 Initialises the block. 6558 %End 6559 6560 void Clear(); 6561 %Docstring 6562 Clear() 6563 6564 Clears the block. 6565 %End 6566 6567 virtual 6568 bool MakeImageBlock( 6569 const wxString & filename, 6570 wxBitmapType imageType, 6571 wxImage & image, 6572 bool convertToJPEG = true 6573 ); 6574 %Docstring 6575 MakeImageBlock(filename, imageType, image, convertToJPEG=True) -> bool 6576 MakeImageBlock(image, imageType, quality=80) -> bool 6577 6578 Load the original image into a memory block. 6579 %End 6580 6581 virtual 6582 bool MakeImageBlock( 6583 wxImage & image, 6584 wxBitmapType imageType, 6585 int quality = 80 6586 ); 6587 6588 virtual 6589 bool MakeImageBlockDefaultQuality( 6590 const wxImage & image, 6591 wxBitmapType imageType 6592 ); 6593 %Docstring 6594 MakeImageBlockDefaultQuality(image, imageType) -> bool 6595 6596 Uses a const wxImage for efficiency, but can't set quality (only 6597 relevant for JPEG) 6598 %End 6599 6600 virtual 6601 bool DoMakeImageBlock( 6602 const wxImage & image, 6603 wxBitmapType imageType 6604 ); 6605 %Docstring 6606 DoMakeImageBlock(image, imageType) -> bool 6607 6608 Makes the image block. 6609 %End 6610 6611 bool Write( 6612 const wxString & filename 6613 ); 6614 %Docstring 6615 Write(filename) -> bool 6616 6617 Writes the block to a file. 6618 %End 6619 6620 bool WriteHex( 6621 wxOutputStream & stream 6622 ); 6623 %Docstring 6624 WriteHex(stream) -> bool 6625 6626 Writes the data in hex to a stream. 6627 %End 6628 6629 bool ReadHex( 6630 wxInputStream & stream, 6631 int length, 6632 wxBitmapType imageType 6633 ); 6634 %Docstring 6635 ReadHex(stream, length, imageType) -> bool 6636 6637 Reads the data in hex from a stream. 6638 %End 6639 6640 void Copy( 6641 const wxRichTextImageBlock & block 6642 ); 6643 %Docstring 6644 Copy(block) 6645 6646 Copy from block. 6647 %End 6648 6649 bool Load( 6650 wxImage & image 6651 ); 6652 %Docstring 6653 Load(image) -> bool 6654 %End 6655 6656 unsigned char * GetData() const; 6657 %Docstring 6658 GetData() -> unsignedchar 6659 6660 Returns the raw data. 6661 %End 6662 6663 size_t GetDataSize() const; 6664 %Docstring 6665 GetDataSize() -> size_t 6666 6667 Returns the data size in bytes. 6668 %End 6669 6670 wxBitmapType GetImageType() const; 6671 %Docstring 6672 GetImageType() -> BitmapType 6673 6674 Returns the image type. 6675 %End 6676 6677 void SetData( 6678 unsigned char * image 6679 ); 6680 %Docstring 6681 SetData(image) 6682 %End 6683 6684 void SetDataSize( 6685 size_t size 6686 ); 6687 %Docstring 6688 SetDataSize(size) 6689 6690 Sets the data size. 6691 %End 6692 6693 void SetImageType( 6694 wxBitmapType imageType 6695 ); 6696 %Docstring 6697 SetImageType(imageType) 6698 6699 Sets the image type. 6700 %End 6701 6702 bool IsOk() const; 6703 %Docstring 6704 IsOk() -> bool 6705 6706 Returns true if the data is non-NULL. 6707 %End 6708 6709 bool Ok() const; 6710 %Docstring 6711 Ok() -> bool 6712 %End 6713 6714 wxString GetExtension() const; 6715 %Docstring 6716 GetExtension() -> String 6717 6718 Gets the extension for the block's type. 6719 %End 6720 6721 static 6722 unsigned char * ReadBlock( 6723 wxInputStream & stream, 6724 size_t size 6725 ); 6726 %Docstring 6727 ReadBlock(stream, size) -> unsignedchar 6728 ReadBlock(filename, size) -> unsignedchar 6729 6730 Implementation. 6731 %End 6732 6733 static 6734 unsigned char * ReadBlock( 6735 const wxString & filename, 6736 size_t size 6737 ); 6738 6739 static 6740 bool WriteBlock( 6741 wxOutputStream & stream, 6742 unsigned char * block, 6743 size_t size 6744 ); 6745 %Docstring 6746 WriteBlock(stream, block, size) -> bool 6747 WriteBlock(filename, block, size) -> bool 6748 6749 Writes a memory block to stream. 6750 %End 6751 6752 static 6753 bool WriteBlock( 6754 const wxString & filename, 6755 unsigned char * block, 6756 size_t size 6757 ); 6758 6759 public: 6760 6761 6762 %Property(name=Data, get=GetData, set=SetData) 6763 %Property(name=DataSize, get=GetDataSize, set=SetDataSize) 6764 %Property(name=Extension, get=GetExtension) 6765 %Property(name=ImageType, get=GetImageType, set=SetImageType) 6766}; // end of class wxRichTextImageBlock 6767 6768 6769class wxRichTextImage : wxRichTextObject 6770{ 6771 %Docstring 6772 RichTextImage(parent=None) 6773 RichTextImage(image, parent=None, charStyle=None) 6774 RichTextImage(imageBlock, parent=None, charStyle=None) 6775 RichTextImage(obj) 6776 6777 This class implements a graphic object. 6778 %End 6779 %TypeHeaderCode 6780 #include <wx/richtext/richtextbuffer.h> 6781 %End 6782 6783public: 6784 wxRichTextImage( 6785 wxRichTextObject * parent = NULL 6786 ); 6787 6788 wxRichTextImage( 6789 const wxImage & image, 6790 wxRichTextObject * parent = NULL, 6791 wxRichTextAttr * charStyle = NULL 6792 ); 6793 6794 wxRichTextImage( 6795 const wxRichTextImageBlock & imageBlock, 6796 wxRichTextObject * parent = NULL, 6797 wxRichTextAttr * charStyle = NULL 6798 ); 6799 6800 wxRichTextImage( 6801 const wxRichTextImage & obj 6802 ); 6803 6804 virtual 6805 bool Draw( 6806 wxDC & dc, 6807 wxRichTextDrawingContext & context, 6808 const wxRichTextRange & range, 6809 const wxRichTextSelection & selection, 6810 const wxRect & rect, 6811 int descent, 6812 int style 6813 ); 6814 %Docstring 6815 Draw(dc, context, range, selection, rect, descent, style) -> bool 6816 6817 Draw the item, within the given range. 6818 %End 6819 6820 virtual 6821 bool Layout( 6822 wxDC & dc, 6823 wxRichTextDrawingContext & context, 6824 const wxRect & rect, 6825 const wxRect & parentRect, 6826 int style 6827 ); 6828 %Docstring 6829 Layout(dc, context, rect, parentRect, style) -> bool 6830 6831 Lay the item out at the specified position with the given size 6832 constraint. 6833 %End 6834 6835 virtual 6836 bool GetRangeSize( 6837 const wxRichTextRange & range, 6838 wxSize & size, 6839 int & descent, 6840 wxDC & dc, 6841 wxRichTextDrawingContext & context, 6842 int flags, 6843 const wxPoint & position = wxPoint(0, 0), 6844 const wxSize & parentSize = wxDefaultSize, 6845 wxArrayInt * partialExtents = NULL 6846 ) const; 6847 %Docstring 6848 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 6849 6850 Returns the object size for the given range. 6851 %End 6852 6853 virtual 6854 wxTextAttrSize GetNaturalSize() const; 6855 %Docstring 6856 GetNaturalSize() -> TextAttrSize 6857 6858 Returns the 'natural' size for this object - the image size. 6859 %End 6860 6861 virtual 6862 bool IsEmpty() const; 6863 %Docstring 6864 IsEmpty() -> bool 6865 6866 Returns true if the object is empty. 6867 %End 6868 6869 virtual 6870 bool CanEditProperties() const; 6871 %Docstring 6872 CanEditProperties() -> bool 6873 6874 Returns true if we can edit the object's properties via a GUI. 6875 %End 6876 6877 virtual 6878 bool EditProperties( 6879 wxWindow * parent, 6880 wxRichTextBuffer * buffer 6881 ); 6882 %Docstring 6883 EditProperties(parent, buffer) -> bool 6884 6885 Edits the object's properties via a GUI. 6886 %End 6887 6888 virtual 6889 wxString GetPropertiesMenuLabel() const; 6890 %Docstring 6891 GetPropertiesMenuLabel() -> String 6892 6893 Returns the label to be used for the properties context menu item. 6894 %End 6895 6896 virtual 6897 bool UsesParagraphAttributes() const; 6898 %Docstring 6899 UsesParagraphAttributes() -> bool 6900 6901 Returns true if this object takes note of paragraph attributes (text 6902 and image objects don't). 6903 %End 6904 6905 virtual 6906 bool ImportFromXML( 6907 wxRichTextBuffer * buffer, 6908 wxXmlNode * node, 6909 wxRichTextXMLHandler * handler, 6910 bool * recurse 6911 ); 6912 %Docstring 6913 ImportFromXML(buffer, node, handler, recurse) -> bool 6914 6915 Imports this object from XML. 6916 %End 6917 6918 virtual 6919 bool IsFloatable() const; 6920 %Docstring 6921 IsFloatable() -> bool 6922 6923 Returns true if this class of object is floatable. 6924 %End 6925 6926 virtual 6927 wxString GetXMLNodeName() const; 6928 %Docstring 6929 GetXMLNodeName() -> String 6930 6931 Returns the XML node name of this object. 6932 %End 6933 6934 const wxBitmap & GetImageCache() const; 6935 %Docstring 6936 GetImageCache() -> wx.Bitmap 6937 6938 Returns the image cache (a scaled bitmap). 6939 %End 6940 6941 void SetImageCache( 6942 const wxBitmap & bitmap 6943 ); 6944 %Docstring 6945 SetImageCache(bitmap) 6946 6947 Sets the image cache. 6948 %End 6949 6950 void ResetImageCache(); 6951 %Docstring 6952 ResetImageCache() 6953 6954 Resets the image cache. 6955 %End 6956 6957 wxRichTextImageBlock & GetImageBlock(); 6958 %Docstring 6959 GetImageBlock() -> RichTextImageBlock 6960 6961 Returns the image block containing the raw data. 6962 %End 6963 6964 wxSize GetOriginalImageSize() const; 6965 %Docstring 6966 GetOriginalImageSize() -> wx.Size 6967 6968 Gets the original image size. 6969 %End 6970 6971 void SetOriginalImageSize( 6972 const wxSize & sz 6973 ); 6974 %Docstring 6975 SetOriginalImageSize(sz) 6976 6977 Sets the original image size. 6978 %End 6979 6980 void Copy( 6981 const wxRichTextImage & obj 6982 ); 6983 %Docstring 6984 Copy(obj) 6985 6986 Copies the image object. 6987 %End 6988 6989 virtual 6990 wxRichTextObject * Clone() const /Factory/; 6991 %Docstring 6992 Clone() -> RichTextObject 6993 6994 Clones the image object. 6995 %End 6996 6997 virtual 6998 bool LoadImageCache( 6999 wxDC & dc, 7000 bool resetCache = false, 7001 const wxSize & parentSize = wxDefaultSize 7002 ); 7003 %Docstring 7004 LoadImageCache(dc, resetCache=False, parentSize=wx.DefaultSize) -> bool 7005 7006 Creates a cached image at the required size. 7007 %End 7008 7009 public: 7010 7011 7012 %Property(name=ImageBlock, get=GetImageBlock) 7013 %Property(name=ImageCache, get=GetImageCache, set=SetImageCache) 7014 %Property(name=NaturalSize, get=GetNaturalSize) 7015 %Property(name=OriginalImageSize, get=GetOriginalImageSize, set=SetOriginalImageSize) 7016 %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel) 7017 %Property(name=XMLNodeName, get=GetXMLNodeName) 7018}; // end of class wxRichTextImage 7019 7020 7021class wxRichTextBuffer : wxRichTextParagraphLayoutBox 7022{ 7023 %Docstring 7024 RichTextBuffer() 7025 RichTextBuffer(obj) 7026 7027 This is a kind of paragraph layout box, used to represent the whole 7028 buffer. 7029 %End 7030 %TypeHeaderCode 7031 #include <wx/richtext/richtextbuffer.h> 7032 %End 7033 7034public: 7035 wxRichTextBuffer(); 7036 7037 wxRichTextBuffer( 7038 const wxRichTextBuffer & obj 7039 ); 7040 7041 virtual 7042 ~wxRichTextBuffer(); 7043 7044 virtual 7045 bool LoadFile( 7046 const wxString & filename, 7047 wxRichTextFileType type = wxRICHTEXT_TYPE_ANY 7048 ); 7049 %Docstring 7050 LoadFile(filename, type=RICHTEXT_TYPE_ANY) -> bool 7051 LoadFile(stream, type=RICHTEXT_TYPE_ANY) -> bool 7052 7053 Loads content from a stream or file. 7054 %End 7055 7056 virtual 7057 bool LoadFile( 7058 wxInputStream & stream, 7059 wxRichTextFileType type = wxRICHTEXT_TYPE_ANY 7060 ); 7061 7062 virtual 7063 bool SaveFile( 7064 const wxString & filename, 7065 wxRichTextFileType type = wxRICHTEXT_TYPE_ANY 7066 ); 7067 %Docstring 7068 SaveFile(filename, type=RICHTEXT_TYPE_ANY) -> bool 7069 SaveFile(stream, type=RICHTEXT_TYPE_ANY) -> bool 7070 7071 Saves content to a stream or file. 7072 %End 7073 7074 virtual 7075 bool SaveFile( 7076 wxOutputStream & stream, 7077 wxRichTextFileType type = wxRICHTEXT_TYPE_ANY 7078 ); 7079 7080 wxCommandProcessor * GetCommandProcessor() const; 7081 %Docstring 7082 GetCommandProcessor() -> wx.CommandProcessor 7083 7084 Returns the command processor. 7085 %End 7086 7087 void SetStyleSheet( 7088 wxRichTextStyleSheet * styleSheet 7089 ); 7090 %Docstring 7091 SetStyleSheet(styleSheet) 7092 7093 Sets style sheet, if any. 7094 %End 7095 7096 virtual 7097 wxRichTextStyleSheet * GetStyleSheet() const; 7098 %Docstring 7099 GetStyleSheet() -> RichTextStyleSheet 7100 7101 Returns the style sheet. 7102 %End 7103 7104 bool SetStyleSheetAndNotify( 7105 wxRichTextStyleSheet * sheet 7106 ); 7107 %Docstring 7108 SetStyleSheetAndNotify(sheet) -> bool 7109 7110 Sets the style sheet and sends a notification of the change. 7111 %End 7112 7113 bool PushStyleSheet( 7114 wxRichTextStyleSheet * styleSheet 7115 ); 7116 %Docstring 7117 PushStyleSheet(styleSheet) -> bool 7118 7119 Pushes the style sheet to the top of the style sheet stack. 7120 %End 7121 7122 wxRichTextStyleSheet * PopStyleSheet(); 7123 %Docstring 7124 PopStyleSheet() -> RichTextStyleSheet 7125 7126 Pops the style sheet from the top of the style sheet stack. 7127 %End 7128 7129 wxRichTextFontTable & GetFontTable(); 7130 %Docstring 7131 GetFontTable() -> RichTextFontTable 7132 7133 Returns the table storing fonts, for quick access and font reuse. 7134 %End 7135 7136 void SetFontTable( 7137 const wxRichTextFontTable & table 7138 ); 7139 %Docstring 7140 SetFontTable(table) 7141 7142 Sets table storing fonts, for quick access and font reuse. 7143 %End 7144 7145 void SetFontScale( 7146 double fontScale 7147 ); 7148 %Docstring 7149 SetFontScale(fontScale) 7150 7151 Sets the scale factor for displaying fonts, for example for more 7152 comfortable editing. 7153 %End 7154 7155 double GetFontScale() const; 7156 %Docstring 7157 GetFontScale() -> double 7158 7159 Returns the scale factor for displaying fonts, for example for more 7160 comfortable editing. 7161 %End 7162 7163 void SetDimensionScale( 7164 double dimScale 7165 ); 7166 %Docstring 7167 SetDimensionScale(dimScale) 7168 7169 Sets the scale factor for displaying certain dimensions such as 7170 indentation and inter-paragraph spacing. 7171 %End 7172 7173 double GetDimensionScale() const; 7174 %Docstring 7175 GetDimensionScale() -> double 7176 7177 Returns the scale factor for displaying certain dimensions such as 7178 indentation and inter-paragraph spacing. 7179 %End 7180 7181 void Init(); 7182 %Docstring 7183 Init() 7184 7185 Initialisation. 7186 %End 7187 7188 virtual 7189 void ResetAndClearCommands(); 7190 %Docstring 7191 ResetAndClearCommands() 7192 7193 Clears the buffer, adds an empty paragraph, and clears the command 7194 processor. 7195 %End 7196 7197 void SetHandlerFlags( 7198 int flags 7199 ); 7200 %Docstring 7201 SetHandlerFlags(flags) 7202 7203 Sets the handler flags, controlling loading and saving. 7204 %End 7205 7206 int GetHandlerFlags() const; 7207 %Docstring 7208 GetHandlerFlags() -> int 7209 7210 Gets the handler flags, controlling loading and saving. 7211 %End 7212 7213 virtual 7214 wxRichTextRange AddParagraph( 7215 const wxString & text, 7216 wxRichTextAttr * paraStyle = NULL 7217 ); 7218 %Docstring 7219 AddParagraph(text, paraStyle=None) -> RichTextRange 7220 7221 Convenience function to add a paragraph of text. 7222 %End 7223 7224 virtual 7225 bool BeginBatchUndo( 7226 const wxString & cmdName 7227 ); 7228 %Docstring 7229 BeginBatchUndo(cmdName) -> bool 7230 7231 Begin collapsing undo/redo commands. 7232 %End 7233 7234 virtual 7235 bool EndBatchUndo(); 7236 %Docstring 7237 EndBatchUndo() -> bool 7238 7239 End collapsing undo/redo commands. 7240 %End 7241 7242 virtual 7243 bool BatchingUndo() const; 7244 %Docstring 7245 BatchingUndo() -> bool 7246 7247 Returns true if we are collapsing commands. 7248 %End 7249 7250 virtual 7251 bool SubmitAction( 7252 wxRichTextAction * action 7253 ); 7254 %Docstring 7255 SubmitAction(action) -> bool 7256 7257 Submit the action immediately, or delay according to whether 7258 collapsing is on. 7259 %End 7260 7261 virtual 7262 wxRichTextCommand * GetBatchedCommand() const; 7263 %Docstring 7264 GetBatchedCommand() -> RichTextCommand 7265 7266 Returns the collapsed command. 7267 %End 7268 7269 virtual 7270 bool BeginSuppressUndo(); 7271 %Docstring 7272 BeginSuppressUndo() -> bool 7273 7274 Begin suppressing undo/redo commands. 7275 %End 7276 7277 virtual 7278 bool EndSuppressUndo(); 7279 %Docstring 7280 EndSuppressUndo() -> bool 7281 7282 End suppressing undo/redo commands. 7283 %End 7284 7285 virtual 7286 bool SuppressingUndo() const; 7287 %Docstring 7288 SuppressingUndo() -> bool 7289 7290 Are we suppressing undo?? 7291 %End 7292 7293 virtual 7294 bool CopyToClipboard( 7295 const wxRichTextRange & range 7296 ); 7297 %Docstring 7298 CopyToClipboard(range) -> bool 7299 7300 Copy the range to the clipboard. 7301 %End 7302 7303 virtual 7304 bool PasteFromClipboard( 7305 long position 7306 ); 7307 %Docstring 7308 PasteFromClipboard(position) -> bool 7309 7310 Paste the clipboard content to the buffer. 7311 %End 7312 7313 virtual 7314 bool CanPasteFromClipboard() const; 7315 %Docstring 7316 CanPasteFromClipboard() -> bool 7317 7318 Returns true if we can paste from the clipboard. 7319 %End 7320 7321 virtual 7322 bool BeginStyle( 7323 const wxRichTextAttr & style 7324 ); 7325 %Docstring 7326 BeginStyle(style) -> bool 7327 7328 Begin using a style. 7329 %End 7330 7331 virtual 7332 bool EndStyle(); 7333 %Docstring 7334 EndStyle() -> bool 7335 7336 End the style. 7337 %End 7338 7339 virtual 7340 bool EndAllStyles(); 7341 %Docstring 7342 EndAllStyles() -> bool 7343 7344 End all styles. 7345 %End 7346 7347 virtual 7348 void ClearStyleStack(); 7349 %Docstring 7350 ClearStyleStack() 7351 7352 Clears the style stack. 7353 %End 7354 7355 virtual 7356 size_t GetStyleStackSize() const; 7357 %Docstring 7358 GetStyleStackSize() -> size_t 7359 7360 Returns the size of the style stack, for example to check correct 7361 nesting. 7362 %End 7363 7364 bool BeginBold(); 7365 %Docstring 7366 BeginBold() -> bool 7367 7368 Begins using bold. 7369 %End 7370 7371 bool EndBold(); 7372 %Docstring 7373 EndBold() -> bool 7374 7375 Ends using bold. 7376 %End 7377 7378 bool BeginItalic(); 7379 %Docstring 7380 BeginItalic() -> bool 7381 7382 Begins using italic. 7383 %End 7384 7385 bool EndItalic(); 7386 %Docstring 7387 EndItalic() -> bool 7388 7389 Ends using italic. 7390 %End 7391 7392 bool BeginUnderline(); 7393 %Docstring 7394 BeginUnderline() -> bool 7395 7396 Begins using underline. 7397 %End 7398 7399 bool EndUnderline(); 7400 %Docstring 7401 EndUnderline() -> bool 7402 7403 Ends using underline. 7404 %End 7405 7406 bool BeginFontSize( 7407 int pointSize 7408 ); 7409 %Docstring 7410 BeginFontSize(pointSize) -> bool 7411 7412 Begins using point size. 7413 %End 7414 7415 bool EndFontSize(); 7416 %Docstring 7417 EndFontSize() -> bool 7418 7419 Ends using point size. 7420 %End 7421 7422 bool BeginFont( 7423 const wxFont & font 7424 ); 7425 %Docstring 7426 BeginFont(font) -> bool 7427 7428 Begins using this font. 7429 %End 7430 7431 bool EndFont(); 7432 %Docstring 7433 EndFont() -> bool 7434 7435 Ends using a font. 7436 %End 7437 7438 bool BeginTextColour( 7439 const wxColour & colour 7440 ); 7441 %Docstring 7442 BeginTextColour(colour) -> bool 7443 7444 Begins using this colour. 7445 %End 7446 7447 bool EndTextColour(); 7448 %Docstring 7449 EndTextColour() -> bool 7450 7451 Ends using a colour. 7452 %End 7453 7454 bool BeginAlignment( 7455 wxTextAttrAlignment alignment 7456 ); 7457 %Docstring 7458 BeginAlignment(alignment) -> bool 7459 7460 Begins using alignment. 7461 %End 7462 7463 bool EndAlignment(); 7464 %Docstring 7465 EndAlignment() -> bool 7466 7467 Ends alignment. 7468 %End 7469 7470 bool BeginLeftIndent( 7471 int leftIndent, 7472 int leftSubIndent = 0 7473 ); 7474 %Docstring 7475 BeginLeftIndent(leftIndent, leftSubIndent=0) -> bool 7476 7477 Begins using leftIndent for the left indent, and optionally 7478 leftSubIndent for the sub-indent. 7479 %End 7480 7481 bool EndLeftIndent(); 7482 %Docstring 7483 EndLeftIndent() -> bool 7484 7485 Ends left indent. 7486 %End 7487 7488 bool BeginRightIndent( 7489 int rightIndent 7490 ); 7491 %Docstring 7492 BeginRightIndent(rightIndent) -> bool 7493 7494 Begins a right indent, specified in tenths of a millimetre. 7495 %End 7496 7497 bool EndRightIndent(); 7498 %Docstring 7499 EndRightIndent() -> bool 7500 7501 Ends right indent. 7502 %End 7503 7504 bool BeginParagraphSpacing( 7505 int before, 7506 int after 7507 ); 7508 %Docstring 7509 BeginParagraphSpacing(before, after) -> bool 7510 7511 Begins paragraph spacing; pass the before-paragraph and after- 7512 paragraph spacing in tenths of a millimetre. 7513 %End 7514 7515 bool EndParagraphSpacing(); 7516 %Docstring 7517 EndParagraphSpacing() -> bool 7518 7519 Ends paragraph spacing. 7520 %End 7521 7522 bool BeginLineSpacing( 7523 int lineSpacing 7524 ); 7525 %Docstring 7526 BeginLineSpacing(lineSpacing) -> bool 7527 7528 Begins line spacing using the specified value. 7529 %End 7530 7531 bool EndLineSpacing(); 7532 %Docstring 7533 EndLineSpacing() -> bool 7534 7535 Ends line spacing. 7536 %End 7537 7538 bool BeginNumberedBullet( 7539 int bulletNumber, 7540 int leftIndent, 7541 int leftSubIndent, 7542 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD 7543 ); 7544 %Docstring 7545 BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle=wx.TEXT_ATTR_BULLET_STYLE_ARABIC|wx.TEXT_ATTR_BULLET_STYLE_PERIOD) -> bool 7546 7547 Begins numbered bullet. 7548 %End 7549 7550 bool EndNumberedBullet(); 7551 %Docstring 7552 EndNumberedBullet() -> bool 7553 7554 Ends numbered bullet. 7555 %End 7556 7557 bool BeginSymbolBullet( 7558 const wxString & symbol, 7559 int leftIndent, 7560 int leftSubIndent, 7561 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL 7562 ); 7563 %Docstring 7564 BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle=wx.TEXT_ATTR_BULLET_STYLE_SYMBOL) -> bool 7565 7566 Begins applying a symbol bullet, using a character from the current 7567 font. 7568 %End 7569 7570 bool EndSymbolBullet(); 7571 %Docstring 7572 EndSymbolBullet() -> bool 7573 7574 Ends symbol bullet. 7575 %End 7576 7577 bool BeginStandardBullet( 7578 const wxString & bulletName, 7579 int leftIndent, 7580 int leftSubIndent, 7581 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD 7582 ); 7583 %Docstring 7584 BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle=wx.TEXT_ATTR_BULLET_STYLE_STANDARD) -> bool 7585 7586 Begins applying a standard bullet, using one of the standard bullet 7587 names (currently standard/circle or standard/square. 7588 %End 7589 7590 bool EndStandardBullet(); 7591 %Docstring 7592 EndStandardBullet() -> bool 7593 7594 Ends standard bullet. 7595 %End 7596 7597 bool BeginCharacterStyle( 7598 const wxString & characterStyle 7599 ); 7600 %Docstring 7601 BeginCharacterStyle(characterStyle) -> bool 7602 7603 Begins named character style. 7604 %End 7605 7606 bool EndCharacterStyle(); 7607 %Docstring 7608 EndCharacterStyle() -> bool 7609 7610 Ends named character style. 7611 %End 7612 7613 bool BeginParagraphStyle( 7614 const wxString & paragraphStyle 7615 ); 7616 %Docstring 7617 BeginParagraphStyle(paragraphStyle) -> bool 7618 7619 Begins named paragraph style. 7620 %End 7621 7622 bool EndParagraphStyle(); 7623 %Docstring 7624 EndParagraphStyle() -> bool 7625 7626 Ends named character style. 7627 %End 7628 7629 bool BeginListStyle( 7630 const wxString & listStyle, 7631 int level = 1, 7632 int number = 1 7633 ); 7634 %Docstring 7635 BeginListStyle(listStyle, level=1, number=1) -> bool 7636 7637 Begins named list style. 7638 %End 7639 7640 bool EndListStyle(); 7641 %Docstring 7642 EndListStyle() -> bool 7643 7644 Ends named character style. 7645 %End 7646 7647 bool BeginURL( 7648 const wxString & url, 7649 const wxString & characterStyle = wxEmptyString 7650 ); 7651 %Docstring 7652 BeginURL(url, characterStyle=wx.EmptyString) -> bool 7653 7654 Begins applying wxTEXT_ATTR_URL to the content. 7655 %End 7656 7657 bool EndURL(); 7658 %Docstring 7659 EndURL() -> bool 7660 7661 Ends URL. 7662 %End 7663 7664 bool AddEventHandler( 7665 wxEvtHandler * handler 7666 ); 7667 %Docstring 7668 AddEventHandler(handler) -> bool 7669 7670 Adds an event handler. 7671 %End 7672 7673 bool RemoveEventHandler( 7674 wxEvtHandler * handler, 7675 bool deleteHandler = false 7676 ); 7677 %Docstring 7678 RemoveEventHandler(handler, deleteHandler=False) -> bool 7679 7680 Removes an event handler from the buffer's list of handlers, deleting 7681 the object if deleteHandler is true. 7682 %End 7683 7684 void ClearEventHandlers(); 7685 %Docstring 7686 ClearEventHandlers() 7687 7688 Clear event handlers. 7689 %End 7690 7691 bool SendEvent( 7692 wxEvent & event, 7693 bool sendToAll = true 7694 ); 7695 %Docstring 7696 SendEvent(event, sendToAll=True) -> bool 7697 7698 Send event to event handlers. 7699 %End 7700 7701 virtual 7702 int HitTest( 7703 wxDC & dc, 7704 wxRichTextDrawingContext & context, 7705 const wxPoint & pt, 7706 long & textPosition /Out/, 7707 wxRichTextObject ** obj /Out/, 7708 wxRichTextObject ** contextObj /Out/, 7709 int flags = 0 7710 ); 7711 %Docstring 7712 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 7713 7714 Hit-testing: returns a flag indicating hit test details, plus 7715 information about position. 7716 %End 7717 7718 void Copy( 7719 const wxRichTextBuffer & obj 7720 ); 7721 %Docstring 7722 Copy(obj) 7723 7724 Copies the buffer. 7725 %End 7726 7727 virtual 7728 wxRichTextObject * Clone() const /Factory/; 7729 %Docstring 7730 Clone() -> RichTextObject 7731 7732 Clones the buffer. 7733 %End 7734 7735 bool InsertParagraphsWithUndo( 7736 long pos, 7737 const wxRichTextParagraphLayoutBox & paragraphs, 7738 wxRichTextCtrl * ctrl, 7739 int flags = 0 7740 ); 7741 %Docstring 7742 InsertParagraphsWithUndo(pos, paragraphs, ctrl, flags=0) -> bool 7743 7744 Submits a command to insert paragraphs. 7745 %End 7746 7747 bool InsertTextWithUndo( 7748 long pos, 7749 const wxString & text, 7750 wxRichTextCtrl * ctrl, 7751 int flags = 0 7752 ); 7753 %Docstring 7754 InsertTextWithUndo(pos, text, ctrl, flags=0) -> bool 7755 7756 Submits a command to insert the given text. 7757 %End 7758 7759 bool InsertNewlineWithUndo( 7760 long pos, 7761 wxRichTextCtrl * ctrl, 7762 int flags = 0 7763 ); 7764 %Docstring 7765 InsertNewlineWithUndo(pos, ctrl, flags=0) -> bool 7766 7767 Submits a command to insert a newline. 7768 %End 7769 7770 bool InsertImageWithUndo( 7771 long pos, 7772 const wxRichTextImageBlock & imageBlock, 7773 wxRichTextCtrl * ctrl, 7774 int flags = 0, 7775 const wxRichTextAttr & textAttr = wxRichTextAttr() 7776 ); 7777 %Docstring 7778 InsertImageWithUndo(pos, imageBlock, ctrl, flags=0, textAttr=RichTextAttr()) -> bool 7779 7780 Submits a command to insert the given image. 7781 %End 7782 7783 wxRichTextObject * InsertObjectWithUndo( 7784 long pos, 7785 wxRichTextObject * object, 7786 wxRichTextCtrl * ctrl, 7787 int flags 7788 ); 7789 %Docstring 7790 InsertObjectWithUndo(pos, object, ctrl, flags) -> RichTextObject 7791 7792 Submits a command to insert an object. 7793 %End 7794 7795 bool DeleteRangeWithUndo( 7796 const wxRichTextRange & range, 7797 wxRichTextCtrl * ctrl 7798 ); 7799 %Docstring 7800 DeleteRangeWithUndo(range, ctrl) -> bool 7801 7802 Submits a command to delete this range. 7803 %End 7804 7805 void Modify( 7806 bool modify = true 7807 ); 7808 %Docstring 7809 Modify(modify=True) 7810 7811 Mark modified. 7812 %End 7813 7814 bool IsModified() const; 7815 %Docstring 7816 IsModified() -> bool 7817 7818 Returns true if the buffer was modified. 7819 %End 7820 7821 double GetScale() const; 7822 %Docstring 7823 GetScale() -> double 7824 7825 Returns the scale factor for calculating dimensions. 7826 %End 7827 7828 void SetScale( 7829 double scale 7830 ); 7831 %Docstring 7832 SetScale(scale) 7833 7834 Sets the scale factor for calculating dimensions. 7835 %End 7836 7837 static 7838 wxRichTextFileHandlerList& GetHandlers() /NoCopy/; 7839 %Docstring 7840 GetHandlers() -> RichTextFileHandlerList 7841 7842 Returns the file handlers. 7843 %End 7844 7845 static 7846 void AddHandler( 7847 wxRichTextFileHandler * handler /Transfer/ 7848 ); 7849 %Docstring 7850 AddHandler(handler) 7851 7852 Adds a file handler to the end. 7853 %End 7854 7855 static 7856 void InsertHandler( 7857 wxRichTextFileHandler * handler /Transfer/ 7858 ); 7859 %Docstring 7860 InsertHandler(handler) 7861 7862 Inserts a file handler at the front. 7863 %End 7864 7865 static 7866 bool RemoveHandler( 7867 const wxString & name 7868 ); 7869 %Docstring 7870 RemoveHandler(name) -> bool 7871 7872 Removes a file handler. 7873 %End 7874 7875 static 7876 wxRichTextFileHandler * FindHandler( 7877 wxRichTextFileType imageType 7878 ) /PyName=FindHandlerByType/; 7879 %Docstring 7880 FindHandlerByType(imageType) -> RichTextFileHandler 7881 7882 Finds a handler by type. 7883 %End 7884 7885 static 7886 wxRichTextFileHandler * FindHandler( 7887 const wxString & extension, 7888 wxRichTextFileType imageType 7889 ) /PyName=FindHandlerByExtension/; 7890 %Docstring 7891 FindHandlerByExtension(extension, imageType) -> RichTextFileHandler 7892 7893 Finds a file handler by extension and type. 7894 %End 7895 7896 static 7897 wxRichTextFileHandler * FindHandler( 7898 const wxString & name 7899 ) /PyName=FindHandlerByName/; 7900 %Docstring 7901 FindHandlerByName(name) -> RichTextFileHandler 7902 7903 Finds a file handler by name. 7904 %End 7905 7906 static 7907 wxRichTextFileHandler * FindHandlerFilenameOrType( 7908 const wxString & filename, 7909 wxRichTextFileType imageType 7910 ) /PyName=FindHandlerByFilename/; 7911 %Docstring 7912 FindHandlerByFilename(filename, imageType) -> RichTextFileHandler 7913 7914 Finds a handler by filename or, if supplied, type. 7915 %End 7916 7917 static PyObject* GetExtWildcard(bool combine=false, bool save=false); 7918 %Docstring 7919 GetExtWildcard(combine=False, save=False) -> PyObject 7920 7921 Gets a wildcard string for the file dialog based on all the currently 7922 loaded richtext file handlers, and a list that can be used to map 7923 those filter types to the file handler type. 7924 %End 7925 %MethodCode 7926 PyErr_Clear(); 7927 Py_BEGIN_ALLOW_THREADS 7928 sipRes = _wxRichTextBuffer_GetExtWildcard(combine, save); 7929 Py_END_ALLOW_THREADS 7930 if (PyErr_Occurred()) sipIsErr = 1; 7931 %End 7932 %TypeCode 7933 PyObject* _wxRichTextBuffer_GetExtWildcard(bool combine, bool save) 7934 { 7935 wxString wildcards; 7936 wxArrayInt types; 7937 wildcards = wxRichTextBuffer::GetExtWildcard(combine, save, &types); 7938 7939 wxPyThreadBlocker blocker; 7940 PyObject* list = PyList_New(0); 7941 for (size_t i=0; i < types.GetCount(); i++) { 7942 PyObject* number = wxPyInt_FromLong(types[i]); 7943 PyList_Append(list, number); 7944 Py_DECREF(number); 7945 } 7946 PyObject* tup = PyTuple_New(2); 7947 PyTuple_SET_ITEM(tup, 0, wx2PyString(wildcards)); 7948 PyTuple_SET_ITEM(tup, 1, list); 7949 return tup; 7950 } 7951 %End 7952 7953 static 7954 void CleanUpHandlers(); 7955 %Docstring 7956 CleanUpHandlers() 7957 7958 Clean up file handlers. 7959 %End 7960 7961 static 7962 void InitStandardHandlers(); 7963 %Docstring 7964 InitStandardHandlers() 7965 7966 Initialise the standard file handlers. 7967 %End 7968 7969 static 7970 wxRichTextDrawingHandlerList& GetDrawingHandlers() /NoCopy/; 7971 %Docstring 7972 GetDrawingHandlers() -> RichTextDrawingHandlerList 7973 7974 Returns the drawing handlers. 7975 %End 7976 7977 static 7978 void AddDrawingHandler( 7979 wxRichTextDrawingHandler * handler /Transfer/ 7980 ); 7981 %Docstring 7982 AddDrawingHandler(handler) 7983 7984 Adds a drawing handler to the end. 7985 %End 7986 7987 static 7988 void InsertDrawingHandler( 7989 wxRichTextDrawingHandler * handler /Transfer/ 7990 ); 7991 %Docstring 7992 InsertDrawingHandler(handler) 7993 7994 Inserts a drawing handler at the front. 7995 %End 7996 7997 static 7998 bool RemoveDrawingHandler( 7999 const wxString & name 8000 ); 8001 %Docstring 8002 RemoveDrawingHandler(name) -> bool 8003 8004 Removes a drawing handler. 8005 %End 8006 8007 static 8008 wxRichTextDrawingHandler * FindDrawingHandler( 8009 const wxString & name 8010 ); 8011 %Docstring 8012 FindDrawingHandler(name) -> RichTextDrawingHandler 8013 8014 Finds a drawing handler by name. 8015 %End 8016 8017 static 8018 void CleanUpDrawingHandlers(); 8019 %Docstring 8020 CleanUpDrawingHandlers() 8021 8022 Clean up drawing handlers. 8023 %End 8024 8025 static 8026 void AddFieldType( 8027 wxRichTextFieldType * fieldType /Transfer/ 8028 ); 8029 %Docstring 8030 AddFieldType(fieldType) 8031 8032 Adds a field type. 8033 %End 8034 8035 static 8036 bool RemoveFieldType( 8037 const wxString & name 8038 ); 8039 %Docstring 8040 RemoveFieldType(name) -> bool 8041 8042 Removes a field type by name. 8043 %End 8044 8045 static 8046 wxRichTextFieldType * FindFieldType( 8047 const wxString & name 8048 ); 8049 %Docstring 8050 FindFieldType(name) -> RichTextFieldType 8051 8052 Finds a field type by name. 8053 %End 8054 8055 static 8056 void CleanUpFieldTypes(); 8057 %Docstring 8058 CleanUpFieldTypes() 8059 8060 Cleans up field types. 8061 %End 8062 8063 static 8064 wxRichTextRenderer * GetRenderer(); 8065 %Docstring 8066 GetRenderer() -> RichTextRenderer 8067 8068 Returns the renderer object. 8069 %End 8070 8071 static 8072 void SetRenderer( 8073 wxRichTextRenderer * renderer 8074 ); 8075 %Docstring 8076 SetRenderer(renderer) 8077 8078 Sets renderer as the object to be used to render certain aspects of 8079 the content, such as bullets. 8080 %End 8081 8082 static 8083 int GetBulletRightMargin(); 8084 %Docstring 8085 GetBulletRightMargin() -> int 8086 8087 Returns the minimum margin between bullet and paragraph in 10ths of a 8088 mm. 8089 %End 8090 8091 static 8092 void SetBulletRightMargin( 8093 int margin 8094 ); 8095 %Docstring 8096 SetBulletRightMargin(margin) 8097 8098 Sets the minimum margin between bullet and paragraph in 10ths of a mm. 8099 %End 8100 8101 static 8102 float GetBulletProportion(); 8103 %Docstring 8104 GetBulletProportion() -> float 8105 8106 Returns the factor to multiply by character height to get a reasonable 8107 bullet size. 8108 %End 8109 8110 static 8111 void SetBulletProportion( 8112 float prop 8113 ); 8114 %Docstring 8115 SetBulletProportion(prop) 8116 8117 Sets the factor to multiply by character height to get a reasonable 8118 bullet size. 8119 %End 8120 8121 static 8122 bool GetFloatingLayoutMode(); 8123 %Docstring 8124 GetFloatingLayoutMode() -> bool 8125 8126 Returns the floating layout mode. 8127 %End 8128 8129 static 8130 void SetFloatingLayoutMode( 8131 bool mode 8132 ); 8133 %Docstring 8134 SetFloatingLayoutMode(mode) 8135 8136 Sets the floating layout mode. 8137 %End 8138 8139 virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, 8140 const wxRichTextRange& range, 8141 const wxRichTextSelection& selection, 8142 const wxRect& rect, int descent, int style); 8143 8144 8145 virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, 8146 const wxRect& rect, const wxRect& parentRect, 8147 int style); 8148 8149 8150 virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, 8151 int& descent, 8152 wxDC& dc, wxRichTextDrawingContext& context, int flags, 8153 const wxPoint& position = wxPoint(0,0), 8154 const wxSize& parentSize = wxDefaultSize, 8155 wxArrayInt* partialExtents = NULL) const; 8156 8157 8158 public: 8159 8160 8161 %Property(name=BatchedCommand, get=GetBatchedCommand) 8162 %Property(name=CommandProcessor, get=GetCommandProcessor) 8163 %Property(name=DimensionScale, get=GetDimensionScale, set=SetDimensionScale) 8164 %Property(name=FontScale, get=GetFontScale, set=SetFontScale) 8165 %Property(name=FontTable, get=GetFontTable, set=SetFontTable) 8166 %Property(name=HandlerFlags, get=GetHandlerFlags, set=SetHandlerFlags) 8167 %Property(name=Scale, get=GetScale, set=SetScale) 8168 %Property(name=StyleSheet, get=GetStyleSheet, set=SetStyleSheet) 8169 %Property(name=StyleStackSize, get=GetStyleStackSize) 8170}; // end of class wxRichTextBuffer 8171 8172 8173class wxRichTextCell : wxRichTextBox 8174{ 8175 %Docstring 8176 RichTextCell(parent=None) 8177 RichTextCell(obj) 8178 8179 wxRichTextCell is the cell in a table, in which the user can type. 8180 %End 8181 %TypeHeaderCode 8182 #include <wx/richtext/richtextbuffer.h> 8183 %End 8184 8185public: 8186 wxRichTextCell( 8187 wxRichTextObject * parent = NULL 8188 ); 8189 8190 wxRichTextCell( 8191 const wxRichTextCell & obj 8192 ); 8193 8194 virtual 8195 bool Draw( 8196 wxDC & dc, 8197 wxRichTextDrawingContext & context, 8198 const wxRichTextRange & range, 8199 const wxRichTextSelection & selection, 8200 const wxRect & rect, 8201 int descent, 8202 int style 8203 ); 8204 %Docstring 8205 Draw(dc, context, range, selection, rect, descent, style) -> bool 8206 8207 Draw the item, within the given range. 8208 %End 8209 8210 virtual 8211 int HitTest( 8212 wxDC & dc, 8213 wxRichTextDrawingContext & context, 8214 const wxPoint & pt, 8215 long & textPosition /Out/, 8216 wxRichTextObject ** obj /Out/, 8217 wxRichTextObject ** contextObj /Out/, 8218 int flags = 0 8219 ); 8220 %Docstring 8221 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 8222 8223 Hit-testing: returns a flag indicating hit test details, plus 8224 information about position. 8225 %End 8226 8227 virtual 8228 wxString GetXMLNodeName() const; 8229 %Docstring 8230 GetXMLNodeName() -> String 8231 8232 Returns the XML node name of this object. 8233 %End 8234 8235 virtual 8236 bool CanEditProperties() const; 8237 %Docstring 8238 CanEditProperties() -> bool 8239 8240 Returns true if we can edit the object's properties via a GUI. 8241 %End 8242 8243 virtual 8244 bool EditProperties( 8245 wxWindow * parent, 8246 wxRichTextBuffer * buffer 8247 ); 8248 %Docstring 8249 EditProperties(parent, buffer) -> bool 8250 8251 Edits the object's properties via a GUI. 8252 %End 8253 8254 virtual 8255 wxString GetPropertiesMenuLabel() const; 8256 %Docstring 8257 GetPropertiesMenuLabel() -> String 8258 8259 Returns the label to be used for the properties context menu item. 8260 %End 8261 8262 int GetColSpan() const; 8263 %Docstring 8264 GetColSpan() -> int 8265 8266 Returns the number of columns spanned by the cell. 8267 %End 8268 8269 void SetColSpan( 8270 long span 8271 ); 8272 %Docstring 8273 SetColSpan(span) 8274 8275 Set the number of columns spanned by the cell. 8276 %End 8277 8278 int GetRowSpan() const; 8279 %Docstring 8280 GetRowSpan() -> int 8281 8282 Returns the number of rows spanned by the cell. 8283 %End 8284 8285 void SetRowSpan( 8286 long span 8287 ); 8288 %Docstring 8289 SetRowSpan(span) 8290 8291 Set the number of rows spanned by the cell. 8292 %End 8293 8294 virtual 8295 wxRichTextObject * Clone() const /Factory/; 8296 %Docstring 8297 Clone() -> RichTextObject 8298 8299 Clones the object. 8300 %End 8301 8302 void Copy( 8303 const wxRichTextCell & obj 8304 ); 8305 %Docstring 8306 Copy(obj) 8307 %End 8308 8309 virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, 8310 const wxRect& rect, const wxRect& parentRect, 8311 int style); 8312 8313 8314 virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, 8315 int& descent, 8316 wxDC& dc, wxRichTextDrawingContext& context, int flags, 8317 const wxPoint& position = wxPoint(0,0), 8318 const wxSize& parentSize = wxDefaultSize, 8319 wxArrayInt* partialExtents = NULL) const; 8320 8321 8322 public: 8323 8324 8325 %Property(name=ColSpan, get=GetColSpan, set=SetColSpan) 8326 %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel) 8327 %Property(name=RowSpan, get=GetRowSpan, set=SetRowSpan) 8328 %Property(name=XMLNodeName, get=GetXMLNodeName) 8329}; // end of class wxRichTextCell 8330 8331 8332class wxRichTextTable : wxRichTextBox 8333{ 8334 %Docstring 8335 RichTextTable(parent=None) 8336 RichTextTable(obj) 8337 8338 wxRichTextTable represents a table with arbitrary columns and rows. 8339 %End 8340 %TypeHeaderCode 8341 #include <wx/richtext/richtextbuffer.h> 8342 %End 8343 8344public: 8345 wxRichTextTable( 8346 wxRichTextObject * parent = NULL 8347 ); 8348 8349 wxRichTextTable( 8350 const wxRichTextTable & obj 8351 ); 8352 8353 virtual 8354 bool Draw( 8355 wxDC & dc, 8356 wxRichTextDrawingContext & context, 8357 const wxRichTextRange & range, 8358 const wxRichTextSelection & selection, 8359 const wxRect & rect, 8360 int descent, 8361 int style 8362 ); 8363 %Docstring 8364 Draw(dc, context, range, selection, rect, descent, style) -> bool 8365 8366 Draw the item, within the given range. 8367 %End 8368 8369 virtual 8370 int HitTest( 8371 wxDC & dc, 8372 wxRichTextDrawingContext & context, 8373 const wxPoint & pt, 8374 long & textPosition /Out/, 8375 wxRichTextObject ** obj /Out/, 8376 wxRichTextObject ** contextObj /Out/, 8377 int flags = 0 8378 ); 8379 %Docstring 8380 HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj) 8381 8382 Hit-testing: returns a flag indicating hit test details, plus 8383 information about position. 8384 %End 8385 8386 virtual 8387 wxString GetXMLNodeName() const; 8388 %Docstring 8389 GetXMLNodeName() -> String 8390 8391 Returns the XML node name of this object. 8392 %End 8393 8394 virtual 8395 bool Layout( 8396 wxDC & dc, 8397 wxRichTextDrawingContext & context, 8398 const wxRect & rect, 8399 const wxRect & parentRect, 8400 int style 8401 ); 8402 %Docstring 8403 Layout(dc, context, rect, parentRect, style) -> bool 8404 8405 Lay the item out at the specified position with the given size 8406 constraint. 8407 %End 8408 8409 virtual 8410 bool GetRangeSize( 8411 const wxRichTextRange & range, 8412 wxSize & size, 8413 int & descent, 8414 wxDC & dc, 8415 wxRichTextDrawingContext & context, 8416 int flags, 8417 const wxPoint & position = wxPoint(0, 0), 8418 const wxSize & parentSize = wxDefaultSize, 8419 wxArrayInt * partialExtents = NULL 8420 ) const; 8421 %Docstring 8422 GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool 8423 8424 Returns the object size for the given range. 8425 %End 8426 8427 virtual 8428 bool DeleteRange( 8429 const wxRichTextRange & range 8430 ); 8431 %Docstring 8432 DeleteRange(range) -> bool 8433 8434 Deletes the given range. 8435 %End 8436 8437 virtual 8438 wxString GetTextForRange( 8439 const wxRichTextRange & range 8440 ) const; 8441 %Docstring 8442 GetTextForRange(range) -> String 8443 8444 Returns any text in this object for the given range. 8445 %End 8446 8447 virtual 8448 bool ImportFromXML( 8449 wxRichTextBuffer * buffer, 8450 wxXmlNode * node, 8451 wxRichTextXMLHandler * handler, 8452 bool * recurse 8453 ); 8454 %Docstring 8455 ImportFromXML(buffer, node, handler, recurse) -> bool 8456 8457 Imports this object from XML. 8458 %End 8459 8460 virtual 8461 bool FindPosition( 8462 wxDC & dc, 8463 wxRichTextDrawingContext & context, 8464 long index, 8465 wxPoint & pt /Out/, 8466 int * height /Out/, 8467 bool forceLineStart 8468 ); 8469 %Docstring 8470 FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height) 8471 8472 Finds the absolute position and row height for the given character 8473 position. 8474 %End 8475 8476 virtual 8477 void CalculateRange( 8478 long start, 8479 long & end /Out/ 8480 ); 8481 %Docstring 8482 CalculateRange(start) -> end 8483 8484 Calculates the range of the object. 8485 %End 8486 8487 virtual 8488 bool HandlesChildSelections() const; 8489 %Docstring 8490 HandlesChildSelections() -> bool 8491 8492 Returns true if this object can handle the selections of its children, 8493 fOr example a table. 8494 %End 8495 8496 virtual 8497 wxRichTextSelection GetSelection( 8498 long start, 8499 long end 8500 ) const; 8501 %Docstring 8502 GetSelection(start, end) -> RichTextSelection 8503 8504 Returns a selection object specifying the selections between start and 8505 end character positions. 8506 %End 8507 8508 virtual 8509 bool CanEditProperties() const; 8510 %Docstring 8511 CanEditProperties() -> bool 8512 8513 Returns true if we can edit the object's properties via a GUI. 8514 %End 8515 8516 virtual 8517 bool EditProperties( 8518 wxWindow * parent, 8519 wxRichTextBuffer * buffer 8520 ); 8521 %Docstring 8522 EditProperties(parent, buffer) -> bool 8523 8524 Edits the object's properties via a GUI. 8525 %End 8526 8527 virtual 8528 wxString GetPropertiesMenuLabel() const; 8529 %Docstring 8530 GetPropertiesMenuLabel() -> String 8531 8532 Returns the label to be used for the properties context menu item. 8533 %End 8534 8535 virtual 8536 bool AcceptsFocus() const; 8537 %Docstring 8538 AcceptsFocus() -> bool 8539 8540 Returns true if objects of this class can accept the focus, i.e. a 8541 call to SetFocusObject is possible. 8542 %End 8543 8544 wxRichTextObjectPtrArrayArray & GetCells(); 8545 %Docstring 8546 GetCells() -> RichTextObjectPtrArrayArray 8547 8548 Returns the cells array. 8549 %End 8550 8551 int GetRowCount() const; 8552 %Docstring 8553 GetRowCount() -> int 8554 8555 Returns the row count. 8556 %End 8557 8558 int GetColumnCount() const; 8559 %Docstring 8560 GetColumnCount() -> int 8561 8562 Returns the column count. 8563 %End 8564 8565 virtual 8566 wxRichTextCell * GetCell( 8567 int row, 8568 int col 8569 ) const; 8570 %Docstring 8571 GetCell(row, col) -> RichTextCell 8572 GetCell(pos) -> RichTextCell 8573 8574 Returns the cell at the given row/column position. 8575 %End 8576 8577 virtual 8578 wxRichTextCell * GetCell( 8579 long pos 8580 ) const; 8581 8582 virtual 8583 bool GetCellRowColumnPosition( 8584 long pos, 8585 int & row, 8586 int & col 8587 ) const; 8588 %Docstring 8589 GetCellRowColumnPosition(pos, row, col) -> bool 8590 8591 Returns the row/column for a given character position. 8592 %End 8593 8594 virtual 8595 wxPosition GetFocusedCell() const; 8596 %Docstring 8597 GetFocusedCell() -> wx.Position 8598 8599 Returns the coordinates of the cell with keyboard focus, or (-1,-1) if 8600 none. 8601 %End 8602 8603 virtual 8604 void ClearTable(); 8605 %Docstring 8606 ClearTable() 8607 8608 Clears the table. 8609 %End 8610 8611 virtual 8612 bool CreateTable( 8613 int rows, 8614 int cols 8615 ); 8616 %Docstring 8617 CreateTable(rows, cols) -> bool 8618 8619 Creates a table of the given dimensions. 8620 %End 8621 8622 virtual 8623 bool SetCellStyle( 8624 const wxRichTextSelection & selection, 8625 const wxRichTextAttr & style, 8626 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO 8627 ); 8628 %Docstring 8629 SetCellStyle(selection, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool 8630 8631 Sets the attributes for the cells specified by the selection. 8632 %End 8633 8634 virtual 8635 bool DeleteRows( 8636 int startRow, 8637 int noRows = 1 8638 ); 8639 %Docstring 8640 DeleteRows(startRow, noRows=1) -> bool 8641 8642 Deletes rows from the given row position. 8643 %End 8644 8645 virtual 8646 bool DeleteColumns( 8647 int startCol, 8648 int noCols = 1 8649 ); 8650 %Docstring 8651 DeleteColumns(startCol, noCols=1) -> bool 8652 8653 Deletes columns from the given column position. 8654 %End 8655 8656 virtual 8657 bool AddRows( 8658 int startRow, 8659 int noRows = 1, 8660 const wxRichTextAttr & attr = wxRichTextAttr() 8661 ); 8662 %Docstring 8663 AddRows(startRow, noRows=1, attr=RichTextAttr()) -> bool 8664 8665 Adds rows from the given row position. 8666 %End 8667 8668 virtual 8669 bool AddColumns( 8670 int startCol, 8671 int noCols = 1, 8672 const wxRichTextAttr & attr = wxRichTextAttr() 8673 ); 8674 %Docstring 8675 AddColumns(startCol, noCols=1, attr=RichTextAttr()) -> bool 8676 8677 Adds columns from the given column position. 8678 %End 8679 8680 virtual 8681 wxRichTextObject * Clone() const /Factory/; 8682 %Docstring 8683 Clone() -> RichTextObject 8684 8685 Clones the object. 8686 %End 8687 8688 void Copy( 8689 const wxRichTextTable & obj 8690 ); 8691 %Docstring 8692 Copy(obj) 8693 %End 8694 8695 public: 8696 8697 8698 %Property(name=Cells, get=GetCells) 8699 %Property(name=ColumnCount, get=GetColumnCount) 8700 %Property(name=FocusedCell, get=GetFocusedCell) 8701 %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel) 8702 %Property(name=RowCount, get=GetRowCount) 8703 %Property(name=XMLNodeName, get=GetXMLNodeName) 8704}; // end of class wxRichTextTable 8705 8706 8707class wxRichTextObjectAddress 8708{ 8709 %Docstring 8710 RichTextObjectAddress(topLevelContainer, obj) 8711 RichTextObjectAddress() 8712 RichTextObjectAddress(address) 8713 8714 A class for specifying an object anywhere in an object hierarchy, 8715 without using a pointer, necessary since wxRTC commands may delete and 8716 recreate sub-objects so physical object addresses change. 8717 %End 8718 %TypeHeaderCode 8719 #include <wx/richtext/richtextbuffer.h> 8720 %End 8721 8722public: 8723 wxRichTextObjectAddress( 8724 wxRichTextParagraphLayoutBox * topLevelContainer, 8725 wxRichTextObject * obj 8726 ); 8727 8728 wxRichTextObjectAddress(); 8729 8730 wxRichTextObjectAddress( 8731 const wxRichTextObjectAddress & address 8732 ); 8733 8734 void Init(); 8735 %Docstring 8736 Init() 8737 %End 8738 8739 void Copy( 8740 const wxRichTextObjectAddress & address 8741 ); 8742 %Docstring 8743 Copy(address) 8744 8745 Copies the address. 8746 %End 8747 8748 wxRichTextObject * GetObject( 8749 wxRichTextParagraphLayoutBox * topLevelContainer 8750 ) const; 8751 %Docstring 8752 GetObject(topLevelContainer) -> RichTextObject 8753 8754 Returns the object specified by the address, given a top level 8755 container. 8756 %End 8757 8758 bool Create( 8759 wxRichTextParagraphLayoutBox * topLevelContainer, 8760 wxRichTextObject * obj 8761 ); 8762 %Docstring 8763 Create(topLevelContainer, obj) -> bool 8764 8765 Creates the address given a container and an object. 8766 %End 8767 8768 wxArrayInt & GetAddress(); 8769 %Docstring 8770 GetAddress() -> ArrayInt 8771 8772 Returns the array of integers representing the object address. 8773 %End 8774 8775 void SetAddress( 8776 const wxArrayInt & address 8777 ); 8778 %Docstring 8779 SetAddress(address) 8780 8781 Sets the address from an array of integers. 8782 %End 8783 8784 public: 8785 8786 8787 %Property(name=Address, get=GetAddress, set=SetAddress) 8788}; // end of class wxRichTextObjectAddress 8789 8790 8791class wxRichTextCommand : wxCommand 8792{ 8793 %Docstring 8794 RichTextCommand(name, id, buffer, container, ctrl, ignoreFirstTime=False) 8795 RichTextCommand(name) 8796 8797 Implements a command on the undo/redo stack. 8798 %End 8799 %TypeHeaderCode 8800 #include <wx/richtext/richtextbuffer.h> 8801 %End 8802 8803public: 8804 wxRichTextCommand( 8805 const wxString & name, 8806 wxRichTextCommandId id, 8807 wxRichTextBuffer * buffer, 8808 wxRichTextParagraphLayoutBox * container, 8809 wxRichTextCtrl * ctrl, 8810 bool ignoreFirstTime = false 8811 ); 8812 8813 wxRichTextCommand( 8814 const wxString & name 8815 ); 8816 8817 virtual 8818 ~wxRichTextCommand(); 8819 8820 virtual 8821 bool Do(); 8822 %Docstring 8823 Do() -> bool 8824 8825 Performs the command. 8826 %End 8827 8828 virtual 8829 bool Undo(); 8830 %Docstring 8831 Undo() -> bool 8832 8833 Undoes the command. 8834 %End 8835 8836 void AddAction( 8837 wxRichTextAction * action /Transfer/ 8838 ); 8839 %Docstring 8840 AddAction(action) 8841 8842 Adds an action to the action list. 8843 %End 8844 8845 void ClearActions(); 8846 %Docstring 8847 ClearActions() 8848 8849 Clears the action list. 8850 %End 8851 8852 wxRichTextActionList& GetActions() /NoCopy/; 8853 %Docstring 8854 GetActions() -> RichTextActionList 8855 8856 Returns the action list. 8857 %End 8858 8859 public: 8860 8861 8862 %Property(name=Actions, get=GetActions) 8863}; // end of class wxRichTextCommand 8864 8865 8866class wxRichTextAction : wxObject 8867{ 8868 %Docstring 8869 RichTextAction(cmd, name, id, buffer, container, ctrl, ignoreFirstTime=False) 8870 8871 Implements a part of a command. 8872 %End 8873 %TypeHeaderCode 8874 #include <wx/richtext/richtextbuffer.h> 8875 %End 8876 8877public: 8878 wxRichTextAction( 8879 wxRichTextCommand * cmd, 8880 const wxString & name, 8881 wxRichTextCommandId id, 8882 wxRichTextBuffer * buffer, 8883 wxRichTextParagraphLayoutBox * container, 8884 wxRichTextCtrl * ctrl, 8885 bool ignoreFirstTime = false 8886 ); 8887 8888 virtual 8889 ~wxRichTextAction(); 8890 8891 bool Do(); 8892 %Docstring 8893 Do() -> bool 8894 8895 Performs the action. 8896 %End 8897 8898 bool Undo(); 8899 %Docstring 8900 Undo() -> bool 8901 8902 Undoes the action. 8903 %End 8904 8905 void UpdateAppearance( 8906 long caretPosition, 8907 bool sendUpdateEvent = false, 8908 wxArrayInt * optimizationLineCharPositions = NULL, 8909 wxArrayInt * optimizationLineYPositions = NULL, 8910 bool isDoCmd = true 8911 ); 8912 %Docstring 8913 UpdateAppearance(caretPosition, sendUpdateEvent=False, optimizationLineCharPositions=None, optimizationLineYPositions=None, isDoCmd=True) 8914 8915 Updates the control appearance, optimizing if possible given 8916 information from the call to Layout. 8917 %End 8918 8919 void ApplyParagraphs( 8920 const wxRichTextParagraphLayoutBox & fragment 8921 ); 8922 %Docstring 8923 ApplyParagraphs(fragment) 8924 8925 Replaces the buffer paragraphs with the given fragment. 8926 %End 8927 8928 wxRichTextParagraphLayoutBox & GetNewParagraphs(); 8929 %Docstring 8930 GetNewParagraphs() -> RichTextParagraphLayoutBox 8931 8932 Returns the new fragments. 8933 %End 8934 8935 wxRichTextParagraphLayoutBox & GetOldParagraphs(); 8936 %Docstring 8937 GetOldParagraphs() -> RichTextParagraphLayoutBox 8938 8939 Returns the old fragments. 8940 %End 8941 8942 wxRichTextAttr & GetAttributes(); 8943 %Docstring 8944 GetAttributes() -> RichTextAttr 8945 8946 Returns the attributes, for single-object commands. 8947 %End 8948 8949 wxRichTextObject * GetObject() const; 8950 %Docstring 8951 GetObject() -> RichTextObject 8952 8953 Returns the object to replace the one at the position defined by the 8954 container address and the action's range start position. 8955 %End 8956 8957 void StoreObject( 8958 wxRichTextObject * obj 8959 ); 8960 %Docstring 8961 StoreObject(obj) 8962 8963 Stores the object to replace the one at the position defined by the 8964 container address without making an address for it. 8965 %End 8966 8967 void SetObject( 8968 wxRichTextObject * obj 8969 ); 8970 %Docstring 8971 SetObject(obj) 8972 8973 Sets the object to replace the one at the position defined by the 8974 container address and the action's range start position. 8975 %End 8976 8977 void MakeObject( 8978 wxRichTextObject * obj 8979 ); 8980 %Docstring 8981 MakeObject(obj) 8982 8983 Makes an address from the given object. 8984 %End 8985 8986 void SetOldAndNewObjects( 8987 wxRichTextObject * oldObj, 8988 wxRichTextObject * newObj 8989 ); 8990 %Docstring 8991 SetOldAndNewObjects(oldObj, newObj) 8992 8993 Sets the existing and new objects, for use with 8994 wxRICHTEXT_CHANGE_OBJECT. 8995 %End 8996 8997 void CalculateRefreshOptimizations( 8998 wxArrayInt & optimizationLineCharPositions, 8999 wxArrayInt & optimizationLineYPositions 9000 ); 9001 %Docstring 9002 CalculateRefreshOptimizations(optimizationLineCharPositions, optimizationLineYPositions) 9003 9004 Calculate arrays for refresh optimization. 9005 %End 9006 9007 void SetPosition( 9008 long pos 9009 ); 9010 %Docstring 9011 SetPosition(pos) 9012 9013 Sets the position used for e.g. 9014 %End 9015 9016 long GetPosition() const; 9017 %Docstring 9018 GetPosition() -> long 9019 9020 Returns the position used for e.g. 9021 %End 9022 9023 void SetRange( 9024 const wxRichTextRange & range 9025 ); 9026 %Docstring 9027 SetRange(range) 9028 9029 Sets the range for e.g. 9030 %End 9031 9032 const wxRichTextRange & GetRange() const; 9033 %Docstring 9034 GetRange() -> RichTextRange 9035 9036 Returns the range for e.g. 9037 %End 9038 9039 wxRichTextObjectAddress & GetContainerAddress(); 9040 %Docstring 9041 GetContainerAddress() -> RichTextObjectAddress 9042 9043 Returns the address (nested position) of the container within the 9044 buffer being manipulated. 9045 %End 9046 9047 void SetContainerAddress( 9048 const wxRichTextObjectAddress & address 9049 ); 9050 %Docstring 9051 SetContainerAddress(address) 9052 SetContainerAddress(container, obj) 9053 9054 Sets the address (nested position) of the container within the buffer 9055 being manipulated. 9056 %End 9057 9058 void SetContainerAddress( 9059 wxRichTextParagraphLayoutBox * container, 9060 wxRichTextObject * obj 9061 ); 9062 9063 wxRichTextParagraphLayoutBox * GetContainer() const; 9064 %Docstring 9065 GetContainer() -> RichTextParagraphLayoutBox 9066 9067 Returns the container that this action refers to, using the container 9068 address and top-level buffer. 9069 %End 9070 9071 const wxString & GetName() const; 9072 %Docstring 9073 GetName() -> String 9074 9075 Returns the action name. 9076 %End 9077 9078 void SetIgnoreFirstTime( 9079 bool b 9080 ); 9081 %Docstring 9082 SetIgnoreFirstTime(b) 9083 9084 Instructs the first Do() command should be skipped as it's already 9085 been applied. 9086 %End 9087 9088 bool GetIgnoreFirstTime() const; 9089 %Docstring 9090 GetIgnoreFirstTime() -> bool 9091 9092 Returns true if the first Do() command should be skipped as it's 9093 already been applied. 9094 %End 9095 9096 public: 9097 9098 9099 %Property(name=Attributes, get=GetAttributes) 9100 %Property(name=Container, get=GetContainer) 9101 %Property(name=ContainerAddress, get=GetContainerAddress, set=SetContainerAddress) 9102 %Property(name=IgnoreFirstTime, get=GetIgnoreFirstTime, set=SetIgnoreFirstTime) 9103 %Property(name=Name, get=GetName) 9104 %Property(name=NewParagraphs, get=GetNewParagraphs) 9105 %Property(name=Object, get=GetObject, set=SetObject) 9106 %Property(name=OldParagraphs, get=GetOldParagraphs) 9107 %Property(name=Position, get=GetPosition, set=SetPosition) 9108 %Property(name=Range, get=GetRange, set=SetRange) 9109}; // end of class wxRichTextAction 9110 9111 9112class wxRichTextFileHandler : wxObject 9113{ 9114 %Docstring 9115 RichTextFileHandler(name=wx.EmptyString, ext=wx.EmptyString, type=0) 9116 9117 The base class for file handlers. 9118 %End 9119 %TypeHeaderCode 9120 #include <wx/richtext/richtextbuffer.h> 9121 %End 9122 9123public: 9124 wxRichTextFileHandler( 9125 const wxString & name = wxEmptyString, 9126 const wxString & ext = wxEmptyString, 9127 int type = 0 9128 ); 9129 9130 bool LoadFile( 9131 wxRichTextBuffer * buffer, 9132 wxInputStream & stream 9133 ); 9134 %Docstring 9135 LoadFile(buffer, stream) -> bool 9136 LoadFile(buffer, filename) -> bool 9137 9138 Loads the buffer from a stream. 9139 %End 9140 9141 virtual 9142 bool LoadFile( 9143 wxRichTextBuffer * buffer, 9144 const wxString & filename 9145 ); 9146 9147 bool SaveFile( 9148 wxRichTextBuffer * buffer, 9149 wxOutputStream & stream 9150 ); 9151 %Docstring 9152 SaveFile(buffer, stream) -> bool 9153 SaveFile(buffer, filename) -> bool 9154 9155 Saves the buffer to a stream. 9156 %End 9157 9158 virtual 9159 bool SaveFile( 9160 wxRichTextBuffer * buffer, 9161 const wxString & filename 9162 ); 9163 9164 virtual 9165 bool CanHandle( 9166 const wxString & filename 9167 ) const; 9168 %Docstring 9169 CanHandle(filename) -> bool 9170 9171 Returns true if we handle this filename (if using files). 9172 %End 9173 9174 virtual 9175 bool CanSave() const; 9176 %Docstring 9177 CanSave() -> bool 9178 9179 Returns true if we can save using this handler. 9180 %End 9181 9182 virtual 9183 bool CanLoad() const; 9184 %Docstring 9185 CanLoad() -> bool 9186 9187 Returns true if we can load using this handler. 9188 %End 9189 9190 virtual 9191 bool IsVisible() const; 9192 %Docstring 9193 IsVisible() -> bool 9194 9195 Returns true if this handler should be visible to the user. 9196 %End 9197 9198 virtual 9199 void SetVisible( 9200 bool visible 9201 ); 9202 %Docstring 9203 SetVisible(visible) 9204 9205 Sets whether the handler should be visible to the user (via the 9206 application's load and save dialogs). 9207 %End 9208 9209 void SetName( 9210 const wxString & name 9211 ); 9212 %Docstring 9213 SetName(name) 9214 9215 Sets the name of the handler. 9216 %End 9217 9218 wxString GetName() const; 9219 %Docstring 9220 GetName() -> String 9221 9222 Returns the name of the handler. 9223 %End 9224 9225 void SetExtension( 9226 const wxString & ext 9227 ); 9228 %Docstring 9229 SetExtension(ext) 9230 9231 Sets the default extension to recognise. 9232 %End 9233 9234 wxString GetExtension() const; 9235 %Docstring 9236 GetExtension() -> String 9237 9238 Returns the default extension to recognise. 9239 %End 9240 9241 void SetType( 9242 int type 9243 ); 9244 %Docstring 9245 SetType(type) 9246 9247 Sets the handler type. 9248 %End 9249 9250 int GetType() const; 9251 %Docstring 9252 GetType() -> int 9253 9254 Returns the handler type. 9255 %End 9256 9257 void SetFlags( 9258 int flags 9259 ); 9260 %Docstring 9261 SetFlags(flags) 9262 9263 Sets flags that change the behaviour of loading or saving. 9264 %End 9265 9266 int GetFlags() const; 9267 %Docstring 9268 GetFlags() -> int 9269 9270 Returns flags controlling how loading and saving is done. 9271 %End 9272 9273 void SetEncoding( 9274 const wxString & encoding 9275 ); 9276 %Docstring 9277 SetEncoding(encoding) 9278 9279 Sets the encoding to use when saving a file. 9280 %End 9281 9282 const wxString & GetEncoding() const; 9283 %Docstring 9284 GetEncoding() -> String 9285 9286 Returns the encoding to use when saving a file. 9287 %End 9288 9289 public: 9290 9291 9292 %Property(name=Encoding, get=GetEncoding, set=SetEncoding) 9293 %Property(name=Extension, get=GetExtension, set=SetExtension) 9294 %Property(name=Flags, get=GetFlags, set=SetFlags) 9295 %Property(name=Name, get=GetName, set=SetName) 9296 %Property(name=Type, get=GetType, set=SetType) 9297 9298protected: 9299 virtual 9300 bool DoLoadFile( 9301 wxRichTextBuffer * buffer, 9302 wxInputStream & stream 9303 ) = 0; 9304 %Docstring 9305 DoLoadFile(buffer, stream) -> bool 9306 9307 Override to load content from stream into buffer. 9308 %End 9309 9310 virtual 9311 bool DoSaveFile( 9312 wxRichTextBuffer * buffer, 9313 wxOutputStream & stream 9314 ) = 0; 9315 %Docstring 9316 DoSaveFile(buffer, stream) -> bool 9317 9318 Override to save content to stream from buffer. 9319 %End 9320 9321}; // end of class wxRichTextFileHandler 9322 9323 9324class wxRichTextPlainTextHandler : wxRichTextFileHandler 9325{ 9326 %Docstring 9327 RichTextPlainTextHandler(name="Text", ext="txt", type=RICHTEXT_TYPE_TEXT) 9328 9329 Implements saving a buffer to plain text. 9330 %End 9331 %TypeHeaderCode 9332 #include <wx/richtext/richtextbuffer.h> 9333 %End 9334 9335public: 9336 wxRichTextPlainTextHandler( 9337 const wxString & name = "Text", 9338 const wxString & ext = "txt", 9339 wxRichTextFileType type = wxRICHTEXT_TYPE_TEXT 9340 ); 9341 9342 virtual 9343 bool CanSave() const; 9344 %Docstring 9345 CanSave() -> bool 9346 9347 Returns true if we can save using this handler. 9348 %End 9349 9350 virtual 9351 bool CanLoad() const; 9352 %Docstring 9353 CanLoad() -> bool 9354 9355 Returns true if we can load using this handler. 9356 %End 9357 9358 9359protected: 9360 virtual 9361 bool DoLoadFile( 9362 wxRichTextBuffer * buffer, 9363 wxInputStream & stream 9364 ); 9365 %Docstring 9366 DoLoadFile(buffer, stream) -> bool 9367 9368 Override to load content from stream into buffer. 9369 %End 9370 9371 virtual 9372 bool DoSaveFile( 9373 wxRichTextBuffer * buffer, 9374 wxOutputStream & stream 9375 ); 9376 %Docstring 9377 DoSaveFile(buffer, stream) -> bool 9378 9379 Override to save content to stream from buffer. 9380 %End 9381 9382}; // end of class wxRichTextPlainTextHandler 9383 9384 9385class wxRichTextDrawingHandler : wxObject 9386{ 9387 %Docstring 9388 RichTextDrawingHandler(name=wx.EmptyString) 9389 9390 The base class for custom drawing handlers. 9391 %End 9392 %TypeHeaderCode 9393 #include <wx/richtext/richtextbuffer.h> 9394 %End 9395 9396public: 9397 wxRichTextDrawingHandler( 9398 const wxString & name = wxEmptyString 9399 ); 9400 9401 virtual 9402 bool HasVirtualAttributes( 9403 wxRichTextObject * obj 9404 ) const = 0; 9405 %Docstring 9406 HasVirtualAttributes(obj) -> bool 9407 9408 Returns true if this object has virtual attributes that we can 9409 provide. 9410 %End 9411 9412 virtual 9413 bool GetVirtualAttributes( 9414 wxRichTextAttr & attr, 9415 wxRichTextObject * obj 9416 ) const = 0; 9417 %Docstring 9418 GetVirtualAttributes(attr, obj) -> bool 9419 9420 Provides virtual attributes that we can provide. 9421 %End 9422 9423 virtual 9424 int GetVirtualSubobjectAttributesCount( 9425 wxRichTextObject * obj 9426 ) const = 0; 9427 %Docstring 9428 GetVirtualSubobjectAttributesCount(obj) -> int 9429 9430 Gets the count for mixed virtual attributes for individual positions 9431 within the object. 9432 %End 9433 9434 virtual 9435 int GetVirtualSubobjectAttributes( 9436 wxRichTextObject * obj, 9437 wxArrayInt & positions, 9438 wxRichTextAttrArray & attributes 9439 ) const = 0; 9440 %Docstring 9441 GetVirtualSubobjectAttributes(obj, positions, attributes) -> int 9442 9443 Gets the mixed virtual attributes for individual positions within the 9444 object. 9445 %End 9446 9447 virtual 9448 bool HasVirtualText( 9449 const wxRichTextPlainText * obj 9450 ) const = 0; 9451 %Docstring 9452 HasVirtualText(obj) -> bool 9453 9454 Do we have virtual text for this object? Virtual text allows an 9455 application to replace characters in an object for editing and display 9456 purposes, for example for highlighting special characters. 9457 %End 9458 9459 virtual 9460 bool GetVirtualText( 9461 const wxRichTextPlainText * obj, 9462 wxString & text 9463 ) const = 0; 9464 %Docstring 9465 GetVirtualText(obj, text) -> bool 9466 9467 Gets the virtual text for this object. 9468 %End 9469 9470 void SetName( 9471 const wxString & name 9472 ); 9473 %Docstring 9474 SetName(name) 9475 9476 Sets the name of the handler. 9477 %End 9478 9479 wxString GetName() const; 9480 %Docstring 9481 GetName() -> String 9482 9483 Returns the name of the handler. 9484 %End 9485 9486 public: 9487 9488 9489 %Property(name=Name, get=GetName, set=SetName) 9490}; // end of class wxRichTextDrawingHandler 9491 9492 9493class wxRichTextBufferDataObject : wxDataObjectSimple 9494{ 9495 %Docstring 9496 RichTextBufferDataObject(richTextBuffer=None) 9497 9498 Implements a rich text data object for clipboard transfer. 9499 %End 9500 %TypeHeaderCode 9501 #include <wx/richtext/richtextbuffer.h> 9502 %End 9503 9504public: 9505 wxRichTextBufferDataObject( 9506 wxRichTextBuffer * richTextBuffer = NULL 9507 ); 9508 9509 virtual 9510 ~wxRichTextBufferDataObject(); 9511 9512 wxRichTextBuffer * GetRichTextBuffer(); 9513 %Docstring 9514 GetRichTextBuffer() -> RichTextBuffer 9515 9516 After a call to this function, the buffer is owned by the caller and 9517 it is responsible for deleting it. 9518 %End 9519 9520 virtual 9521 wxDataFormat GetPreferredFormat( 9522 Direction dir 9523 ) const; 9524 %Docstring 9525 GetPreferredFormat(dir) -> wx.DataFormat 9526 9527 Returns the preferred format for either rendering the data (if dir is 9528 Get, its default value) or for setting it. 9529 %End 9530 9531 virtual 9532 size_t GetDataSize() const; 9533 %Docstring 9534 GetDataSize() -> size_t 9535 GetDataSize(format) -> size_t 9536 9537 Gets the size of our data. 9538 %End 9539 9540 virtual 9541 size_t GetDataSize( 9542 const wxDataFormat & format 9543 ) const; 9544 9545 virtual 9546 bool GetDataHere( 9547 void * buf 9548 ) const; 9549 %Docstring 9550 GetDataHere(buf) -> bool 9551 GetDataHere(format, buf) -> bool 9552 9553 Copy the data to the buffer, return true on success. 9554 %End 9555 9556 virtual 9557 bool GetDataHere( 9558 const wxDataFormat & format, 9559 void * buf 9560 ) const; 9561 9562 virtual 9563 bool SetData( 9564 size_t len, 9565 const void * buf 9566 ); 9567 %Docstring 9568 SetData(len, buf) -> bool 9569 SetData(format, len, buf) -> bool 9570 9571 Copy the data from the buffer, return true on success. 9572 %End 9573 9574 virtual 9575 bool SetData( 9576 const wxDataFormat & format, 9577 size_t len, 9578 const void * buf 9579 ); 9580 9581 static 9582 const wxChar * GetRichTextBufferFormatId(); 9583 %Docstring 9584 GetRichTextBufferFormatId() -> Char 9585 9586 Returns the id for the new data format. 9587 %End 9588 9589 public: 9590 9591 9592 %Property(name=DataSize, get=GetDataSize) 9593 %Property(name=RichTextBuffer, get=GetRichTextBuffer) 9594}; // end of class wxRichTextBufferDataObject 9595 9596 9597class wxRichTextRenderer : wxObject 9598{ 9599 %Docstring 9600 RichTextRenderer() 9601 9602 This class isolates some common drawing functionality. 9603 %End 9604 %TypeHeaderCode 9605 #include <wx/richtext/richtextbuffer.h> 9606 %End 9607 9608public: 9609 wxRichTextRenderer(); 9610 9611 virtual 9612 ~wxRichTextRenderer(); 9613 9614 virtual 9615 bool DrawStandardBullet( 9616 wxRichTextParagraph * paragraph, 9617 wxDC & dc, 9618 const wxRichTextAttr & attr, 9619 const wxRect & rect 9620 ) = 0; 9621 %Docstring 9622 DrawStandardBullet(paragraph, dc, attr, rect) -> bool 9623 9624 Draws a standard bullet, as specified by the value of GetBulletName. 9625 %End 9626 9627 virtual 9628 bool DrawTextBullet( 9629 wxRichTextParagraph * paragraph, 9630 wxDC & dc, 9631 const wxRichTextAttr & attr, 9632 const wxRect & rect, 9633 const wxString & text 9634 ) = 0; 9635 %Docstring 9636 DrawTextBullet(paragraph, dc, attr, rect, text) -> bool 9637 9638 Draws a bullet that can be described by text, such as numbered or 9639 symbol bullets. 9640 %End 9641 9642 virtual 9643 bool DrawBitmapBullet( 9644 wxRichTextParagraph * paragraph, 9645 wxDC & dc, 9646 const wxRichTextAttr & attr, 9647 const wxRect & rect 9648 ) = 0; 9649 %Docstring 9650 DrawBitmapBullet(paragraph, dc, attr, rect) -> bool 9651 9652 Draws a bitmap bullet, where the bullet bitmap is specified by the 9653 value of GetBulletName. 9654 %End 9655 9656 virtual 9657 bool EnumerateStandardBulletNames( 9658 wxArrayString & bulletNames 9659 ) = 0; 9660 %Docstring 9661 EnumerateStandardBulletNames(bulletNames) -> bool 9662 9663 Enumerate the standard bullet names currently supported. 9664 %End 9665 9666}; // end of class wxRichTextRenderer 9667 9668 9669class wxRichTextStdRenderer : wxRichTextRenderer 9670{ 9671 %Docstring 9672 RichTextStdRenderer() 9673 9674 The standard renderer for drawing bullets. 9675 %End 9676 %TypeHeaderCode 9677 #include <wx/richtext/richtextbuffer.h> 9678 %End 9679 9680public: 9681 wxRichTextStdRenderer(); 9682 9683 virtual 9684 bool DrawStandardBullet( 9685 wxRichTextParagraph * paragraph, 9686 wxDC & dc, 9687 const wxRichTextAttr & attr, 9688 const wxRect & rect 9689 ); 9690 %Docstring 9691 DrawStandardBullet(paragraph, dc, attr, rect) -> bool 9692 9693 Draws a standard bullet, as specified by the value of GetBulletName. 9694 %End 9695 9696 virtual 9697 bool DrawTextBullet( 9698 wxRichTextParagraph * paragraph, 9699 wxDC & dc, 9700 const wxRichTextAttr & attr, 9701 const wxRect & rect, 9702 const wxString & text 9703 ); 9704 %Docstring 9705 DrawTextBullet(paragraph, dc, attr, rect, text) -> bool 9706 9707 Draws a bullet that can be described by text, such as numbered or 9708 symbol bullets. 9709 %End 9710 9711 virtual 9712 bool DrawBitmapBullet( 9713 wxRichTextParagraph * paragraph, 9714 wxDC & dc, 9715 const wxRichTextAttr & attr, 9716 const wxRect & rect 9717 ); 9718 %Docstring 9719 DrawBitmapBullet(paragraph, dc, attr, rect) -> bool 9720 9721 Draws a bitmap bullet, where the bullet bitmap is specified by the 9722 value of GetBulletName. 9723 %End 9724 9725 virtual 9726 bool EnumerateStandardBulletNames( 9727 wxArrayString & bulletNames 9728 ); 9729 %Docstring 9730 EnumerateStandardBulletNames(bulletNames) -> bool 9731 9732 Enumerate the standard bullet names currently supported. 9733 %End 9734 9735}; // end of class wxRichTextStdRenderer 9736 9737 9738bool wxRichTextHasStyle( 9739 int flags, 9740 int style 9741); 9742%Docstring 9743 RichTextHasStyle(flags, style) -> bool 9744%End 9745 9746bool wxTextAttrEq( 9747 const wxRichTextAttr & attr1, 9748 const wxRichTextAttr & attr2 9749); 9750%Docstring 9751 TextAttrEq(attr1, attr2) -> bool 9752 9753 Compare two attribute objects. 9754%End 9755 9756bool wxRichTextApplyStyle( 9757 wxRichTextAttr & destStyle, 9758 const wxRichTextAttr & style, 9759 wxRichTextAttr * compareWith = NULL 9760); 9761%Docstring 9762 RichTextApplyStyle(destStyle, style, compareWith=None) -> bool 9763 9764 Apply one style to another. 9765%End 9766 9767bool wxRichTextRemoveStyle( 9768 wxRichTextAttr & destStyle, 9769 const wxRichTextAttr & style 9770); 9771%Docstring 9772 RichTextRemoveStyle(destStyle, style) -> bool 9773%End 9774 9775bool wxRichTextCombineBitlists( 9776 int & valueA, 9777 int valueB, 9778 int & flagsA, 9779 int flagsB 9780); 9781%Docstring 9782 RichTextCombineBitlists(valueA, valueB, flagsA, flagsB) -> bool 9783 9784 Combine two bitlists. 9785%End 9786 9787bool wxRichTextBitlistsEqPartial( 9788 int valueA, 9789 int valueB, 9790 int flags 9791); 9792%Docstring 9793 RichTextBitlistsEqPartial(valueA, valueB, flags) -> bool 9794 9795 Compare two bitlists. 9796%End 9797 9798bool wxRichTextSplitParaCharStyles( 9799 const wxRichTextAttr & style, 9800 wxRichTextAttr & parStyle, 9801 wxRichTextAttr & charStyle 9802); 9803%Docstring 9804 RichTextSplitParaCharStyles(style, parStyle, charStyle) -> bool 9805 9806 Split into paragraph and character styles. 9807%End 9808 9809bool wxRichTextTabsEq( 9810 const wxArrayInt & tabs1, 9811 const wxArrayInt & tabs2 9812); 9813%Docstring 9814 RichTextTabsEq(tabs1, tabs2) -> bool 9815 9816 Compare tabs. 9817%End 9818 9819wxString wxRichTextDecimalToRoman( 9820 long n 9821); 9822%Docstring 9823 RichTextDecimalToRoman(n) -> String 9824 9825 Convert a decimal to Roman numerals. 9826%End 9827 9828void wxTextAttrCollectCommonAttributes( 9829 wxTextAttr & currentStyle, 9830 const wxTextAttr & attr, 9831 wxTextAttr & clashingAttr, 9832 wxTextAttr & absentAttr 9833); 9834%Docstring 9835 TextAttrCollectCommonAttributes(currentStyle, attr, clashingAttr, absentAttr) 9836%End 9837 9838void wxRichTextModuleInit(); 9839%Docstring 9840 RichTextModuleInit() 9841%End 9842 9843class wxRichTextRangeArray 9844{ 9845public: 9846 SIP_SSIZE_T __len__(); 9847 %MethodCode 9848 sipRes = sipCpp->GetCount(); 9849 %End 9850 9851 wxRichTextRange& __getitem__(long index); 9852 %MethodCode 9853 if (0 > index) 9854 index += sipCpp->GetCount(); 9855 9856 if ((index < sipCpp->GetCount()) && (0 <= index)) { 9857 sipRes = &sipCpp->Item(index); 9858 } 9859 else { 9860 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 9861 sipError = sipErrorFail; 9862 } 9863 %End 9864 9865 9866 int __contains__(wxRichTextRange& obj); 9867 %MethodCode 9868 int idx = sipCpp->Index(*obj, false); 9869 sipRes = idx != wxNOT_FOUND; 9870 %End 9871 9872 void append(wxRichTextRange& obj); 9873 %MethodCode 9874 sipCpp->Add(*obj); 9875 %End 9876 9877 // TODO: add support for index(value, [start, [stop]]) 9878 int index(wxRichTextRange& obj); 9879 %MethodCode 9880 int idx = sipCpp->Index(*obj, false); 9881 if (idx == wxNOT_FOUND) { 9882 sipError = sipErrorFail; 9883 wxPyErr_SetString(PyExc_ValueError, 9884 "sequence.index(x): x not in sequence"); 9885 } 9886 sipRes = idx; 9887 %End 9888}; 9889 9890%Extract(id=pycode_richtext) 9891def _RichTextRangeArray___repr__(self): 9892 return "RichTextRangeArray: " + repr(list(self)) 9893RichTextRangeArray.__repr__ = _RichTextRangeArray___repr__ 9894del _RichTextRangeArray___repr__ 9895%End 9896 9897 9898class wxRichTextAttrArray 9899{ 9900public: 9901 SIP_SSIZE_T __len__(); 9902 %MethodCode 9903 sipRes = sipCpp->GetCount(); 9904 %End 9905 9906 wxRichTextAttr& __getitem__(long index); 9907 %MethodCode 9908 if (0 > index) 9909 index += sipCpp->GetCount(); 9910 9911 if ((index < sipCpp->GetCount()) && (0 <= index)) { 9912 sipRes = &sipCpp->Item(index); 9913 } 9914 else { 9915 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 9916 sipError = sipErrorFail; 9917 } 9918 %End 9919 9920 9921 int __contains__(wxRichTextAttr& obj); 9922 %MethodCode 9923 int idx = sipCpp->Index(*obj, false); 9924 sipRes = idx != wxNOT_FOUND; 9925 %End 9926 9927 void append(wxRichTextAttr& obj); 9928 %MethodCode 9929 sipCpp->Add(*obj); 9930 %End 9931 9932 // TODO: add support for index(value, [start, [stop]]) 9933 int index(wxRichTextAttr& obj); 9934 %MethodCode 9935 int idx = sipCpp->Index(*obj, false); 9936 if (idx == wxNOT_FOUND) { 9937 sipError = sipErrorFail; 9938 wxPyErr_SetString(PyExc_ValueError, 9939 "sequence.index(x): x not in sequence"); 9940 } 9941 sipRes = idx; 9942 %End 9943}; 9944 9945%Extract(id=pycode_richtext) 9946def _RichTextAttrArray___repr__(self): 9947 return "RichTextAttrArray: " + repr(list(self)) 9948RichTextAttrArray.__repr__ = _RichTextAttrArray___repr__ 9949del _RichTextAttrArray___repr__ 9950%End 9951 9952 9953class wxRichTextVariantArray 9954{ 9955public: 9956 SIP_SSIZE_T __len__(); 9957 %MethodCode 9958 sipRes = sipCpp->GetCount(); 9959 %End 9960 9961 wxVariant& __getitem__(long index); 9962 %MethodCode 9963 if (0 > index) 9964 index += sipCpp->GetCount(); 9965 9966 if ((index < sipCpp->GetCount()) && (0 <= index)) { 9967 sipRes = &sipCpp->Item(index); 9968 } 9969 else { 9970 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 9971 sipError = sipErrorFail; 9972 } 9973 %End 9974 9975 9976 int __contains__(wxVariant& obj); 9977 %MethodCode 9978 int idx = sipCpp->Index(*obj, false); 9979 sipRes = idx != wxNOT_FOUND; 9980 %End 9981 9982 void append(wxVariant& obj); 9983 %MethodCode 9984 sipCpp->Add(*obj); 9985 %End 9986 9987 // TODO: add support for index(value, [start, [stop]]) 9988 int index(wxVariant& obj); 9989 %MethodCode 9990 int idx = sipCpp->Index(*obj, false); 9991 if (idx == wxNOT_FOUND) { 9992 sipError = sipErrorFail; 9993 wxPyErr_SetString(PyExc_ValueError, 9994 "sequence.index(x): x not in sequence"); 9995 } 9996 sipRes = idx; 9997 %End 9998}; 9999 10000%Extract(id=pycode_richtext) 10001def _RichTextVariantArray___repr__(self): 10002 return "RichTextVariantArray: " + repr(list(self)) 10003RichTextVariantArray.__repr__ = _RichTextVariantArray___repr__ 10004del _RichTextVariantArray___repr__ 10005%End 10006 10007 10008class wxRichTextObjectList_iterator /Abstract/ 10009{ 10010 // the C++ implementation of this class 10011 %TypeHeaderCode 10012 10013 class wxRichTextObjectList_iterator { 10014 public: 10015 wxRichTextObjectList_iterator(wxRichTextObjectList::compatibility_iterator start) 10016 : m_node(start) {} 10017 10018 wxRichTextObject* __next__() { 10019 wxRichTextObject* obj = NULL; 10020 if (m_node) { 10021 obj = (wxRichTextObject*) m_node->GetData(); 10022 m_node = m_node->GetNext(); 10023 } 10024 else { 10025 PyErr_SetString(PyExc_StopIteration, ""); 10026 } 10027 return (wxRichTextObject*)obj; 10028 } 10029 private: 10030 wxRichTextObjectList::compatibility_iterator m_node; 10031 }; 10032 %End 10033public: 10034 wxRichTextObject* __next__(); 10035 %MethodCode 10036 sipRes = sipCpp->__next__(); 10037 if (PyErr_Occurred()) 10038 return NULL; 10039 %End 10040}; 10041 10042class wxRichTextObjectList 10043{ 10044 %TypeHeaderCode 10045 10046 %End 10047public: 10048 SIP_SSIZE_T __len__(); 10049 %MethodCode 10050 sipRes = sipCpp->size(); 10051 %End 10052 10053 wxRichTextObject* __getitem__(long index); 10054 %MethodCode 10055 if (0 > index) 10056 index += sipCpp->size(); 10057 10058 if (index < sipCpp->size() && (0 <= index)) { 10059 wxRichTextObjectList::compatibility_iterator node = sipCpp->Item(index); 10060 if (node) 10061 sipRes = (wxRichTextObject*)node->GetData(); 10062 } 10063 else { 10064 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10065 sipError = sipErrorFail; 10066 } 10067 %End 10068 10069 int __contains__(const wxRichTextObject* obj); 10070 %MethodCode 10071 wxRichTextObjectList::compatibility_iterator node; 10072 node = sipCpp->Find((wxRichTextObject*)obj); 10073 sipRes = node != NULL; 10074 %End 10075 10076 wxRichTextObjectList_iterator* __iter__() /Factory/; 10077 %MethodCode 10078 sipRes = new wxRichTextObjectList_iterator(sipCpp->GetFirst()); 10079 %End 10080 10081 // TODO: add support for index(value, [start, [stop]]) 10082 int index(wxRichTextObject* obj); 10083 %MethodCode 10084 int idx = sipCpp->IndexOf((wxRichTextObject*)obj); 10085 if (idx == wxNOT_FOUND) { 10086 sipError = sipErrorFail; 10087 wxPyErr_SetString(PyExc_ValueError, 10088 "sequence.index(x): x not in sequence"); 10089 } 10090 sipRes = idx; 10091 %End 10092 10093 10094}; 10095 10096%Extract(id=pycode_richtext) 10097def _RichTextObjectList___repr__(self): 10098 return "RichTextObjectList: " + repr(list(self)) 10099RichTextObjectList.__repr__ = _RichTextObjectList___repr__ 10100del _RichTextObjectList___repr__ 10101%End 10102 10103 10104class wxRichTextLineList_iterator /Abstract/ 10105{ 10106 // the C++ implementation of this class 10107 %TypeHeaderCode 10108 10109 class wxRichTextLineList_iterator { 10110 public: 10111 wxRichTextLineList_iterator(wxRichTextLineList::compatibility_iterator start) 10112 : m_node(start) {} 10113 10114 wxRichTextLine* __next__() { 10115 wxRichTextLine* obj = NULL; 10116 if (m_node) { 10117 obj = (wxRichTextLine*) m_node->GetData(); 10118 m_node = m_node->GetNext(); 10119 } 10120 else { 10121 PyErr_SetString(PyExc_StopIteration, ""); 10122 } 10123 return (wxRichTextLine*)obj; 10124 } 10125 private: 10126 wxRichTextLineList::compatibility_iterator m_node; 10127 }; 10128 %End 10129public: 10130 wxRichTextLine* __next__(); 10131 %MethodCode 10132 sipRes = sipCpp->__next__(); 10133 if (PyErr_Occurred()) 10134 return NULL; 10135 %End 10136}; 10137 10138class wxRichTextLineList 10139{ 10140 %TypeHeaderCode 10141 10142 %End 10143public: 10144 SIP_SSIZE_T __len__(); 10145 %MethodCode 10146 sipRes = sipCpp->size(); 10147 %End 10148 10149 wxRichTextLine* __getitem__(long index); 10150 %MethodCode 10151 if (0 > index) 10152 index += sipCpp->size(); 10153 10154 if (index < sipCpp->size() && (0 <= index)) { 10155 wxRichTextLineList::compatibility_iterator node = sipCpp->Item(index); 10156 if (node) 10157 sipRes = (wxRichTextLine*)node->GetData(); 10158 } 10159 else { 10160 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10161 sipError = sipErrorFail; 10162 } 10163 %End 10164 10165 int __contains__(const wxRichTextLine* obj); 10166 %MethodCode 10167 wxRichTextLineList::compatibility_iterator node; 10168 node = sipCpp->Find((wxRichTextLine*)obj); 10169 sipRes = node != NULL; 10170 %End 10171 10172 wxRichTextLineList_iterator* __iter__() /Factory/; 10173 %MethodCode 10174 sipRes = new wxRichTextLineList_iterator(sipCpp->GetFirst()); 10175 %End 10176 10177 // TODO: add support for index(value, [start, [stop]]) 10178 int index(wxRichTextLine* obj); 10179 %MethodCode 10180 int idx = sipCpp->IndexOf((wxRichTextLine*)obj); 10181 if (idx == wxNOT_FOUND) { 10182 sipError = sipErrorFail; 10183 wxPyErr_SetString(PyExc_ValueError, 10184 "sequence.index(x): x not in sequence"); 10185 } 10186 sipRes = idx; 10187 %End 10188 10189 10190}; 10191 10192%Extract(id=pycode_richtext) 10193def _RichTextLineList___repr__(self): 10194 return "RichTextLineList: " + repr(list(self)) 10195RichTextLineList.__repr__ = _RichTextLineList___repr__ 10196del _RichTextLineList___repr__ 10197%End 10198 10199 10200class wxRichTextObjectPtrArray 10201{ 10202public: 10203 SIP_SSIZE_T __len__(); 10204 %MethodCode 10205 sipRes = sipCpp->GetCount(); 10206 %End 10207 10208 wxRichTextObject* __getitem__(long index); 10209 %MethodCode 10210 if (0 > index) 10211 index += sipCpp->GetCount(); 10212 10213 if ((index < sipCpp->GetCount()) && (0 <= index)) { 10214 sipRes = sipCpp->Item(index); 10215 } 10216 else { 10217 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10218 sipError = sipErrorFail; 10219 } 10220 %End 10221 10222 int __contains__(wxRichTextObject* obj); 10223 %MethodCode 10224 int idx = sipCpp->Index(obj, false); 10225 sipRes = idx != wxNOT_FOUND; 10226 %End 10227 10228 void append(wxRichTextObject* obj); 10229 %MethodCode 10230 sipCpp->Add(obj); 10231 %End 10232 10233 // TODO: add support for index(value, [start, [stop]]) 10234 int index(wxRichTextObject* obj); 10235 %MethodCode 10236 int idx = sipCpp->Index(obj, false); 10237 if (idx == wxNOT_FOUND) { 10238 sipError = sipErrorFail; 10239 wxPyErr_SetString(PyExc_ValueError, 10240 "sequence.index(x): x not in sequence"); 10241 } 10242 sipRes = idx; 10243 %End 10244}; 10245 10246%Extract(id=pycode_richtext) 10247def _RichTextObjectPtrArray___repr__(self): 10248 return "RichTextObjectPtrArray: " + repr(list(self)) 10249RichTextObjectPtrArray.__repr__ = _RichTextObjectPtrArray___repr__ 10250del _RichTextObjectPtrArray___repr__ 10251%End 10252 10253 10254class wxRichTextObjectPtrArrayArray 10255{ 10256public: 10257 SIP_SSIZE_T __len__(); 10258 %MethodCode 10259 sipRes = sipCpp->GetCount(); 10260 %End 10261 10262 wxRichTextObjectPtrArray& __getitem__(long index); 10263 %MethodCode 10264 if (0 > index) 10265 index += sipCpp->GetCount(); 10266 10267 if ((index < sipCpp->GetCount()) && (0 <= index)) { 10268 sipRes = &sipCpp->Item(index); 10269 } 10270 else { 10271 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10272 sipError = sipErrorFail; 10273 } 10274 %End 10275 10276 10277 int __contains__(wxRichTextObjectPtrArray& obj); 10278 %MethodCode 10279 int idx = sipCpp->Index(*obj, false); 10280 sipRes = idx != wxNOT_FOUND; 10281 %End 10282 10283 void append(wxRichTextObjectPtrArray& obj); 10284 %MethodCode 10285 sipCpp->Add(*obj); 10286 %End 10287 10288 // TODO: add support for index(value, [start, [stop]]) 10289 int index(wxRichTextObjectPtrArray& obj); 10290 %MethodCode 10291 int idx = sipCpp->Index(*obj, false); 10292 if (idx == wxNOT_FOUND) { 10293 sipError = sipErrorFail; 10294 wxPyErr_SetString(PyExc_ValueError, 10295 "sequence.index(x): x not in sequence"); 10296 } 10297 sipRes = idx; 10298 %End 10299}; 10300 10301%Extract(id=pycode_richtext) 10302def _RichTextObjectPtrArrayArray___repr__(self): 10303 return "RichTextObjectPtrArrayArray: " + repr(list(self)) 10304RichTextObjectPtrArrayArray.__repr__ = _RichTextObjectPtrArrayArray___repr__ 10305del _RichTextObjectPtrArrayArray___repr__ 10306%End 10307 10308 10309%Extract(id=pycode_richtext) 10310from collections import namedtuple 10311_im_RichTextRange = namedtuple('_im_RichTextRange', ['Start', 'End']) 10312del namedtuple 10313 10314%End 10315 10316class wxRichTextObjectList__iterator /Abstract/ 10317{ 10318 // the C++ implementation of this class 10319 %TypeHeaderCode 10320 typedef wxList wxRichTextObjectList_; 10321 class wxRichTextObjectList__iterator { 10322 public: 10323 wxRichTextObjectList__iterator(wxRichTextObjectList_::compatibility_iterator start) 10324 : m_node(start) {} 10325 10326 wxRichTextObject* __next__() { 10327 wxRichTextObject* obj = NULL; 10328 if (m_node) { 10329 obj = (wxRichTextObject*) m_node->GetData(); 10330 m_node = m_node->GetNext(); 10331 } 10332 else { 10333 PyErr_SetString(PyExc_StopIteration, ""); 10334 } 10335 return (wxRichTextObject*)obj; 10336 } 10337 private: 10338 wxRichTextObjectList_::compatibility_iterator m_node; 10339 }; 10340 %End 10341public: 10342 wxRichTextObject* __next__(); 10343 %MethodCode 10344 sipRes = sipCpp->__next__(); 10345 if (PyErr_Occurred()) 10346 return NULL; 10347 %End 10348}; 10349 10350class wxRichTextObjectList_ 10351{ 10352 %TypeHeaderCode 10353 typedef wxList wxRichTextObjectList_; 10354 %End 10355public: 10356 SIP_SSIZE_T __len__(); 10357 %MethodCode 10358 sipRes = sipCpp->size(); 10359 %End 10360 10361 wxRichTextObject* __getitem__(long index); 10362 %MethodCode 10363 if (0 > index) 10364 index += sipCpp->size(); 10365 10366 if (index < sipCpp->size() && (0 <= index)) { 10367 wxRichTextObjectList_::compatibility_iterator node = sipCpp->Item(index); 10368 if (node) 10369 sipRes = (wxRichTextObject*)node->GetData(); 10370 } 10371 else { 10372 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10373 sipError = sipErrorFail; 10374 } 10375 %End 10376 10377 int __contains__(const wxRichTextObject* obj); 10378 %MethodCode 10379 wxRichTextObjectList_::compatibility_iterator node; 10380 node = sipCpp->Find((wxRichTextObject*)obj); 10381 sipRes = node != NULL; 10382 %End 10383 10384 wxRichTextObjectList__iterator* __iter__() /Factory/; 10385 %MethodCode 10386 sipRes = new wxRichTextObjectList__iterator(sipCpp->GetFirst()); 10387 %End 10388 10389 // TODO: add support for index(value, [start, [stop]]) 10390 int index(wxRichTextObject* obj); 10391 %MethodCode 10392 int idx = sipCpp->IndexOf((wxRichTextObject*)obj); 10393 if (idx == wxNOT_FOUND) { 10394 sipError = sipErrorFail; 10395 wxPyErr_SetString(PyExc_ValueError, 10396 "sequence.index(x): x not in sequence"); 10397 } 10398 sipRes = idx; 10399 %End 10400 10401 10402}; 10403 10404%Extract(id=pycode_richtext) 10405def _RichTextObjectList____repr__(self): 10406 return "RichTextObjectList_: " + repr(list(self)) 10407RichTextObjectList_.__repr__ = _RichTextObjectList____repr__ 10408del _RichTextObjectList____repr__ 10409%End 10410 10411 10412class wxRichTextFileHandlerList_iterator /Abstract/ 10413{ 10414 // the C++ implementation of this class 10415 %TypeHeaderCode 10416 typedef wxList wxRichTextFileHandlerList; 10417 class wxRichTextFileHandlerList_iterator { 10418 public: 10419 wxRichTextFileHandlerList_iterator(wxRichTextFileHandlerList::compatibility_iterator start) 10420 : m_node(start) {} 10421 10422 wxRichTextFileHandler* __next__() { 10423 wxRichTextFileHandler* obj = NULL; 10424 if (m_node) { 10425 obj = (wxRichTextFileHandler*) m_node->GetData(); 10426 m_node = m_node->GetNext(); 10427 } 10428 else { 10429 PyErr_SetString(PyExc_StopIteration, ""); 10430 } 10431 return (wxRichTextFileHandler*)obj; 10432 } 10433 private: 10434 wxRichTextFileHandlerList::compatibility_iterator m_node; 10435 }; 10436 %End 10437public: 10438 wxRichTextFileHandler* __next__(); 10439 %MethodCode 10440 sipRes = sipCpp->__next__(); 10441 if (PyErr_Occurred()) 10442 return NULL; 10443 %End 10444}; 10445 10446class wxRichTextFileHandlerList 10447{ 10448 %TypeHeaderCode 10449 typedef wxList wxRichTextFileHandlerList; 10450 %End 10451public: 10452 SIP_SSIZE_T __len__(); 10453 %MethodCode 10454 sipRes = sipCpp->size(); 10455 %End 10456 10457 wxRichTextFileHandler* __getitem__(long index); 10458 %MethodCode 10459 if (0 > index) 10460 index += sipCpp->size(); 10461 10462 if (index < sipCpp->size() && (0 <= index)) { 10463 wxRichTextFileHandlerList::compatibility_iterator node = sipCpp->Item(index); 10464 if (node) 10465 sipRes = (wxRichTextFileHandler*)node->GetData(); 10466 } 10467 else { 10468 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10469 sipError = sipErrorFail; 10470 } 10471 %End 10472 10473 int __contains__(const wxRichTextFileHandler* obj); 10474 %MethodCode 10475 wxRichTextFileHandlerList::compatibility_iterator node; 10476 node = sipCpp->Find((wxRichTextFileHandler*)obj); 10477 sipRes = node != NULL; 10478 %End 10479 10480 wxRichTextFileHandlerList_iterator* __iter__() /Factory/; 10481 %MethodCode 10482 sipRes = new wxRichTextFileHandlerList_iterator(sipCpp->GetFirst()); 10483 %End 10484 10485 // TODO: add support for index(value, [start, [stop]]) 10486 int index(wxRichTextFileHandler* obj); 10487 %MethodCode 10488 int idx = sipCpp->IndexOf((wxRichTextFileHandler*)obj); 10489 if (idx == wxNOT_FOUND) { 10490 sipError = sipErrorFail; 10491 wxPyErr_SetString(PyExc_ValueError, 10492 "sequence.index(x): x not in sequence"); 10493 } 10494 sipRes = idx; 10495 %End 10496 10497 10498}; 10499 10500%Extract(id=pycode_richtext) 10501def _RichTextFileHandlerList___repr__(self): 10502 return "RichTextFileHandlerList: " + repr(list(self)) 10503RichTextFileHandlerList.__repr__ = _RichTextFileHandlerList___repr__ 10504del _RichTextFileHandlerList___repr__ 10505%End 10506 10507 10508class wxRichTextDrawingHandlerList_iterator /Abstract/ 10509{ 10510 // the C++ implementation of this class 10511 %TypeHeaderCode 10512 typedef wxList wxRichTextDrawingHandlerList; 10513 class wxRichTextDrawingHandlerList_iterator { 10514 public: 10515 wxRichTextDrawingHandlerList_iterator(wxRichTextDrawingHandlerList::compatibility_iterator start) 10516 : m_node(start) {} 10517 10518 wxRichTextDrawingHandler* __next__() { 10519 wxRichTextDrawingHandler* obj = NULL; 10520 if (m_node) { 10521 obj = (wxRichTextDrawingHandler*) m_node->GetData(); 10522 m_node = m_node->GetNext(); 10523 } 10524 else { 10525 PyErr_SetString(PyExc_StopIteration, ""); 10526 } 10527 return (wxRichTextDrawingHandler*)obj; 10528 } 10529 private: 10530 wxRichTextDrawingHandlerList::compatibility_iterator m_node; 10531 }; 10532 %End 10533public: 10534 wxRichTextDrawingHandler* __next__(); 10535 %MethodCode 10536 sipRes = sipCpp->__next__(); 10537 if (PyErr_Occurred()) 10538 return NULL; 10539 %End 10540}; 10541 10542class wxRichTextDrawingHandlerList 10543{ 10544 %TypeHeaderCode 10545 typedef wxList wxRichTextDrawingHandlerList; 10546 %End 10547public: 10548 SIP_SSIZE_T __len__(); 10549 %MethodCode 10550 sipRes = sipCpp->size(); 10551 %End 10552 10553 wxRichTextDrawingHandler* __getitem__(long index); 10554 %MethodCode 10555 if (0 > index) 10556 index += sipCpp->size(); 10557 10558 if (index < sipCpp->size() && (0 <= index)) { 10559 wxRichTextDrawingHandlerList::compatibility_iterator node = sipCpp->Item(index); 10560 if (node) 10561 sipRes = (wxRichTextDrawingHandler*)node->GetData(); 10562 } 10563 else { 10564 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10565 sipError = sipErrorFail; 10566 } 10567 %End 10568 10569 int __contains__(const wxRichTextDrawingHandler* obj); 10570 %MethodCode 10571 wxRichTextDrawingHandlerList::compatibility_iterator node; 10572 node = sipCpp->Find((wxRichTextDrawingHandler*)obj); 10573 sipRes = node != NULL; 10574 %End 10575 10576 wxRichTextDrawingHandlerList_iterator* __iter__() /Factory/; 10577 %MethodCode 10578 sipRes = new wxRichTextDrawingHandlerList_iterator(sipCpp->GetFirst()); 10579 %End 10580 10581 // TODO: add support for index(value, [start, [stop]]) 10582 int index(wxRichTextDrawingHandler* obj); 10583 %MethodCode 10584 int idx = sipCpp->IndexOf((wxRichTextDrawingHandler*)obj); 10585 if (idx == wxNOT_FOUND) { 10586 sipError = sipErrorFail; 10587 wxPyErr_SetString(PyExc_ValueError, 10588 "sequence.index(x): x not in sequence"); 10589 } 10590 sipRes = idx; 10591 %End 10592 10593 10594}; 10595 10596%Extract(id=pycode_richtext) 10597def _RichTextDrawingHandlerList___repr__(self): 10598 return "RichTextDrawingHandlerList: " + repr(list(self)) 10599RichTextDrawingHandlerList.__repr__ = _RichTextDrawingHandlerList___repr__ 10600del _RichTextDrawingHandlerList___repr__ 10601%End 10602 10603 10604class wxRichTextActionList_iterator /Abstract/ 10605{ 10606 // the C++ implementation of this class 10607 %TypeHeaderCode 10608 typedef wxList wxRichTextActionList; 10609 class wxRichTextActionList_iterator { 10610 public: 10611 wxRichTextActionList_iterator(wxRichTextActionList::compatibility_iterator start) 10612 : m_node(start) {} 10613 10614 wxRichTextAction* __next__() { 10615 wxRichTextAction* obj = NULL; 10616 if (m_node) { 10617 obj = (wxRichTextAction*) m_node->GetData(); 10618 m_node = m_node->GetNext(); 10619 } 10620 else { 10621 PyErr_SetString(PyExc_StopIteration, ""); 10622 } 10623 return (wxRichTextAction*)obj; 10624 } 10625 private: 10626 wxRichTextActionList::compatibility_iterator m_node; 10627 }; 10628 %End 10629public: 10630 wxRichTextAction* __next__(); 10631 %MethodCode 10632 sipRes = sipCpp->__next__(); 10633 if (PyErr_Occurred()) 10634 return NULL; 10635 %End 10636}; 10637 10638class wxRichTextActionList 10639{ 10640 %TypeHeaderCode 10641 typedef wxList wxRichTextActionList; 10642 %End 10643public: 10644 SIP_SSIZE_T __len__(); 10645 %MethodCode 10646 sipRes = sipCpp->size(); 10647 %End 10648 10649 wxRichTextAction* __getitem__(long index); 10650 %MethodCode 10651 if (0 > index) 10652 index += sipCpp->size(); 10653 10654 if (index < sipCpp->size() && (0 <= index)) { 10655 wxRichTextActionList::compatibility_iterator node = sipCpp->Item(index); 10656 if (node) 10657 sipRes = (wxRichTextAction*)node->GetData(); 10658 } 10659 else { 10660 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range"); 10661 sipError = sipErrorFail; 10662 } 10663 %End 10664 10665 int __contains__(const wxRichTextAction* obj); 10666 %MethodCode 10667 wxRichTextActionList::compatibility_iterator node; 10668 node = sipCpp->Find((wxRichTextAction*)obj); 10669 sipRes = node != NULL; 10670 %End 10671 10672 wxRichTextActionList_iterator* __iter__() /Factory/; 10673 %MethodCode 10674 sipRes = new wxRichTextActionList_iterator(sipCpp->GetFirst()); 10675 %End 10676 10677 // TODO: add support for index(value, [start, [stop]]) 10678 int index(wxRichTextAction* obj); 10679 %MethodCode 10680 int idx = sipCpp->IndexOf((wxRichTextAction*)obj); 10681 if (idx == wxNOT_FOUND) { 10682 sipError = sipErrorFail; 10683 wxPyErr_SetString(PyExc_ValueError, 10684 "sequence.index(x): x not in sequence"); 10685 } 10686 sipRes = idx; 10687 %End 10688 10689 10690}; 10691 10692%Extract(id=pycode_richtext) 10693def _RichTextActionList___repr__(self): 10694 return "RichTextActionList: " + repr(list(self)) 10695RichTextActionList.__repr__ = _RichTextActionList___repr__ 10696del _RichTextActionList___repr__ 10697%End 10698 10699 10700 10701//--------------------------------------------------------------------------- 10702 10703