File: wx.richtext.RichTextParagraph.txt

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

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.richtext.RichTextParagraph:

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextParagraph**
==========================================================================================================================================

This object represents a single paragraph containing various objects such as text content, images, and further paragraph layout objects.          







         



.. seealso:: :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextCtrl`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RichTextParagraph</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.richtext.RichTextParagraph_inheritance.png" alt="Inheritance diagram of RichTextParagraph" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextParagraph.html" title="wx.richtext.RichTextParagraph" alt="" coords="27,237,236,267"/> <area shape="rect" id="node2" href="wx.richtext.RichTextCompositeObject.html" title="wx.richtext.RichTextCompositeObject" alt="" coords="5,160,259,189"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="91,5,172,35"/> <area shape="rect" id="node4" href="wx.richtext.RichTextObject.html" title="wx.richtext.RichTextObject" alt="" coords="39,83,225,112"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextParagraph.__init__`                                  Constructor taking a parent and style.
:meth:`~wx.richtext.RichTextParagraph.AllocateLine`                              Allocates or reuses a line object.
:meth:`~wx.richtext.RichTextParagraph.ApplyParagraphStyle`                       Applies paragraph styles such as centering to the wrapped lines.
:meth:`~wx.richtext.RichTextParagraph.CalculateRange`                            Calculates the range of the object.
:meth:`~wx.richtext.RichTextParagraph.ClearDefaultTabs`                          Clears the default tabstop array.
:meth:`~wx.richtext.RichTextParagraph.ClearLines`                                Clears the cached lines.
:meth:`~wx.richtext.RichTextParagraph.ClearUnusedLines`                          Clears remaining unused line objects, if any.
:meth:`~wx.richtext.RichTextParagraph.Clone`                                     Clones the object.
:meth:`~wx.richtext.RichTextParagraph.Copy`                                      Copies the object.
:meth:`~wx.richtext.RichTextParagraph.Draw`                                      Draw the item, within the given range.
:meth:`~wx.richtext.RichTextParagraph.FindObjectAtPosition`                      Finds the object at the given position.
:meth:`~wx.richtext.RichTextParagraph.FindPosition`                              Finds the absolute position and row height for the given character position.
:meth:`~wx.richtext.RichTextParagraph.FindWrapPosition`                          Finds a suitable wrap position.
:meth:`~wx.richtext.RichTextParagraph.GetBulletText`                             Returns the bullet text for this paragraph.
:meth:`~wx.richtext.RichTextParagraph.GetCombinedAttributes`                     Returns combined attributes of the base style, paragraph style and character style.
:meth:`~wx.richtext.RichTextParagraph.GetContiguousPlainText`                    Returns the plain text searching from the start or end of the range.
:meth:`~wx.richtext.RichTextParagraph.GetDefaultTabs`                            Returns the default tabstop array.
:meth:`~wx.richtext.RichTextParagraph.GetFirstLineBreakPosition`                 Returns the first position from pos that has a line break character.
:meth:`~wx.richtext.RichTextParagraph.GetLines`                                  Returns the cached lines.
:meth:`~wx.richtext.RichTextParagraph.GetRangeSize`                              Returns the object size for the given range.
:meth:`~wx.richtext.RichTextParagraph.GetXMLNodeName`                            Returns the ``XML`` node name of this object.
:meth:`~wx.richtext.RichTextParagraph.HitTest`                                   Hit-testing: returns a flag indicating hit test details, plus information about position.
:meth:`~wx.richtext.RichTextParagraph.InitDefaultTabs`                           Creates a default tabstop array.
:meth:`~wx.richtext.RichTextParagraph.InsertText`                                Inserts text at the given position.
:meth:`~wx.richtext.RichTextParagraph.Layout`                                    Lay the item out at the specified position with the given size constraint.
:meth:`~wx.richtext.RichTextParagraph.LayoutFloat`                               Lays out the floating objects.
:meth:`~wx.richtext.RichTextParagraph.MoveFromList`                              Adds content back from a list.
:meth:`~wx.richtext.RichTextParagraph.MoveToList`                                Moves content to a list from this point.
:meth:`~wx.richtext.RichTextParagraph.SplitAt`                                   Splits an object at this position if necessary, and returns the previous object, or ``None`` if inserting at the beginning.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextParagraph.BulletText`                                See :meth:`~wx.richtext.RichTextParagraph.GetBulletText`
:attr:`~wx.richtext.RichTextParagraph.CombinedAttributes`                        See :meth:`~wx.richtext.RichTextParagraph.GetCombinedAttributes`
:attr:`~wx.richtext.RichTextParagraph.Lines`                                     See :meth:`~wx.richtext.RichTextParagraph.GetLines`
:attr:`~wx.richtext.RichTextParagraph.XMLNodeName`                               See :meth:`~wx.richtext.RichTextParagraph.GetXMLNodeName`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.richtext.RichTextParagraph(RichTextCompositeObject)

   **Possible constructors**::

       RichTextParagraph(parent=None, style=None)
       
       RichTextParagraph(text, parent=None, paraStyle=None, charStyle=None)
       
       RichTextParagraph(obj)
       
   
   This object represents a single paragraph containing various objects
   such as text content, images, and further paragraph layout objects.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self, parent=None, style=None)`
      
      Constructor taking a parent and style.                  
      
      
      :param `parent`: 
      :type `parent`: wx.richtext.RichTextObject
      :param `style`: 
      :type `style`: wx.richtext.RichTextAttr
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, text, parent=None, paraStyle=None, charStyle=None)`
      
      Constructor taking a text string, a parent and paragraph and character attributes.                  
      
      
      :param `text`: 
      :type `text`: string
      :param `parent`: 
      :type `parent`: wx.richtext.RichTextObject
      :param `paraStyle`: 
      :type `paraStyle`: wx.richtext.RichTextAttr
      :param `charStyle`: 
      :type `charStyle`: wx.richtext.RichTextAttr
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, obj)`
      
      
      
      
      :param `obj`: 
      :type `obj`: wx.richtext.RichTextParagraph
      
      
      
      
      
      
      **~~~**






   .. method:: AllocateLine(self, pos)

      Allocates or reuses a line object.                  


      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.richtext.RichTextLine`








   .. method:: ApplyParagraphStyle(self, line, attr, rect, dc)

      Applies paragraph styles such as centering to the wrapped lines.                  


      :param `line`: 
      :type `line`: wx.richtext.RichTextLine
      :param `attr`: 
      :type `attr`: wx.richtext.RichTextAttr
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `dc`: 
      :type `dc`: wx.DC







   .. method:: CalculateRange(self, start)

      Calculates the range of the object.                  

      By default, guess that the object is 1 unit long.                  


      :param `start`: 
      :type `start`: long




      :rtype: `end`








   .. staticmethod:: ClearDefaultTabs()

      Clears the default tabstop array.                   





   .. method:: ClearLines(self)

      Clears the cached lines.                   





   .. method:: ClearUnusedLines(self, lineCount)

      Clears remaining unused line objects, if any.                  


      :param `lineCount`: 
      :type `lineCount`: int




      :rtype: `bool`








   .. method:: Clone(self)

      Clones the object.                  

      :rtype: :ref:`wx.richtext.RichTextObject`








   .. method:: Copy(self, obj)

      Copies the object.                  


      :param `obj`: 
      :type `obj`: wx.richtext.RichTextParagraph







   .. method:: Draw(self, dc, context, range, selection, rect, descent, style)

      Draw the item, within the given range.                  

      Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `selection`: 
      :type `selection`: wx.richtext.RichTextSelection
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `descent`: 
      :type `descent`: int
      :param `style`: 
      :type `style`: int




      :rtype: `bool`








   .. method:: FindObjectAtPosition(self, position)

      Finds the object at the given position.                  


      :param `position`: 
      :type `position`: long




      :rtype: :ref:`wx.richtext.RichTextObject`








   .. method:: FindPosition(self, dc, context, index, forceLineStart)

      Finds the absolute position and row height for the given character position.                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `index`: 
      :type `index`: long
      :param `forceLineStart`: 
      :type `forceLineStart`: bool




      :rtype: `tuple`







      :returns: 

         ( `bool`, `pt`, `height` ) 








   .. method:: FindWrapPosition(self, range, dc, context, availableSpace, wrapPosition, partialExtents)

      Finds a suitable wrap position.                  

      `wrapPosition`  is the last position in the line to the left of the split.                  


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `availableSpace`: 
      :type `availableSpace`: int
      :param `wrapPosition`: 
      :type `wrapPosition`: long
      :param `partialExtents`: 
      :type `partialExtents`: list of integers




      :rtype: `bool`








   .. method:: GetBulletText(self)

      Returns the bullet text for this paragraph.                  

      :rtype: `string`








   .. method:: GetCombinedAttributes(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **GetCombinedAttributes** `(self, contentStyle, includingBoxAttr=False)`
      
      Returns combined attributes of the base style, paragraph style and character style.                  
      
      We use this to dynamically retrieve the actual style.                  
      
      
      :param `contentStyle`: 
      :type `contentStyle`: wx.richtext.RichTextAttr
      :param `includingBoxAttr`: 
      :type `includingBoxAttr`: bool
      
      
      
      
      :rtype: :ref:`wx.richtext.RichTextAttr`
      
      
      
      
      
      
      
      **~~~**

      
      **GetCombinedAttributes** `(self, includingBoxAttr=False)`
      
      Returns the combined attributes of the base style and paragraph style.                  
      
      
      :param `includingBoxAttr`: 
      :type `includingBoxAttr`: bool
      
      
      
      
      :rtype: :ref:`wx.richtext.RichTextAttr`
      
      
      
      
      
      
      
      **~~~**






   .. method:: GetContiguousPlainText(self, text, range, fromStart=True)

      Returns the plain text searching from the start or end of the range.                  

      The resulting string may be shorter than the range given.                  


      :param `text`: 
      :type `text`: string
      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `fromStart`: 
      :type `fromStart`: bool




      :rtype: `bool`








   .. staticmethod:: GetDefaultTabs()

      Returns the default tabstop array.                  

      :rtype: `list of integers`








   .. method:: GetFirstLineBreakPosition(self, pos)

      Returns the first position from pos that has a line break character.                  


      :param `pos`: 
      :type `pos`: long




      :rtype: `long`








   .. method:: GetLines(self)

      Returns the cached lines.                  

      :rtype: :ref:`RichTextLineList`








   .. method:: GetRangeSize(self, range, size, descent, dc, context, flags, position=Point(0,0), parentSize=DefaultSize, partialExtents=None)

      Returns the object size for the given range.                  

      Returns ``False`` if the range is invalid for this object.                  


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `size`: 
      :type `size`: wx.Size
      :param `descent`: 
      :type `descent`: int
      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `flags`: 
      :type `flags`: int
      :param `position`: 
      :type `position`: wx.Point
      :param `parentSize`: 
      :type `parentSize`: wx.Size
      :param `partialExtents`: 
      :type `partialExtents`: list of integers




      :rtype: `bool`








   .. method:: GetXMLNodeName(self)

      Returns the ``XML`` node name of this object.                  

      This must be overridden for XmlNode-base ``XML`` export to work.                  

      :rtype: `string`








   .. method:: HitTest(self, dc, context, pt, flags=0)

      Hit-testing: returns a flag indicating hit test details, plus information about position.                  

      `contextObj`  is returned to specify what object position is relevant to, since otherwise there's an ambiguity. @ obj might not be a child of `contextObj`, since we may be referring to the container itself if we have no hit on a child - for example if we click outside an object. 

      The function puts the position in `textPosition`  if one is found. `pt`  is in logical units (a zero y position is at the beginning of the buffer). 

                


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `pt`: 
      :type `pt`: wx.Point
      :param `flags`: 
      :type `flags`: int




      :rtype: `tuple`







      :returns: 

         ( `int`, `textPosition`, `obj`, `contextObj` ) 








   .. staticmethod:: InitDefaultTabs()

      Creates a default tabstop array.                   





   .. method:: InsertText(self, pos, text)

      Inserts text at the given position.                  


      :param `pos`: 
      :type `pos`: long
      :param `text`: 
      :type `text`: string




      :rtype: `bool`








   .. method:: Layout(self, dc, context, rect, parentRect, style)

      Lay the item out at the specified position with the given size constraint.                  

      Layout must set the cached size. `rect`  is the available space for the object, and `parentRect`  is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box).                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `parentRect`: 
      :type `parentRect`: wx.Rect
      :param `style`: 
      :type `style`: int




      :rtype: `bool`








   .. method:: LayoutFloat(self, dc, context, rect, parentRect, style, floatCollector)

      Lays out the floating objects.                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `parentRect`: 
      :type `parentRect`: wx.Rect
      :param `style`: 
      :type `style`: int
      :param `floatCollector`: 
      :type `floatCollector`: RichTextFloatCollector







   .. method:: MoveFromList(self, list)

      Adds content back from a list.                  


      :param `list`: 
      :type `list`: :class:`RichTextObjectList_`







   .. method:: MoveToList(self, obj, list)

      Moves content to a list from this point.                  


      :param `obj`: 
      :type `obj`: wx.richtext.RichTextObject
      :param `list`: 
      :type `list`: :class:`RichTextObjectList_`







   .. method:: SplitAt(self, pos, previousObject=None)

      Splits an object at this position if necessary, and returns the previous object, or ``None`` if inserting at the beginning.                  


      :param `pos`: 
      :type `pos`: long
      :param `previousObject`: 
      :type `previousObject`: RichTextObject




      :rtype: :ref:`wx.richtext.RichTextObject`








   .. attribute:: BulletText

      See :meth:`~wx.richtext.RichTextParagraph.GetBulletText`


   .. attribute:: CombinedAttributes

      See :meth:`~wx.richtext.RichTextParagraph.GetCombinedAttributes`


   .. attribute:: Lines

      See :meth:`~wx.richtext.RichTextParagraph.GetLines`


   .. attribute:: XMLNodeName

      See :meth:`~wx.richtext.RichTextParagraph.GetXMLNodeName`