phoenix_title wx.richtext.RichTextParagraph

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

See also

wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextParagraph:

method_summary Methods Summary

__init__

Constructor taking a parent and style.

AllocateLine

Allocates or reuses a line object.

ApplyParagraphStyle

Applies paragraph styles such as centering to the wrapped lines.

CalculateRange

Calculates the range of the object.

ClearDefaultTabs

Clears the default tabstop array.

ClearLines

Clears the cached lines.

ClearUnusedLines

Clears remaining unused line objects, if any.

Clone

Clones the object.

Copy

Copies the object.

Draw

Draw the item, within the given range.

FindObjectAtPosition

Finds the object at the given position.

FindPosition

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

FindWrapPosition

Finds a suitable wrap position.

GetBulletText

Returns the bullet text for this paragraph.

GetCombinedAttributes

Returns combined attributes of the base style, paragraph style and character style.

GetContiguousPlainText

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

GetDefaultTabs

Returns the default tabstop array.

GetFirstLineBreakPosition

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

GetImpactedByFloatingObjects

Whether the paragraph is impacted by floating objects from above.

GetLines

Returns the cached lines.

GetRangeSize

Returns the object size for the given range.

GetXMLNodeName

Returns the XML node name of this object.

HitTest

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

Init

InitDefaultTabs

Creates a default tabstop array.

InsertText

Inserts text at the given position.

Layout

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

LayoutFloat

Lays out the floating objects.

MoveFromList

Adds content back from a list.

MoveToList

Moves content to a list from this point.

SetImpactedByFloatingObjects

Sets whether the paragraph is impacted by floating objects from above.

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

BulletText

See GetBulletText

CombinedAttributes

See GetCombinedAttributes

ImpactedByFloatingObjects

See GetImpactedByFloatingObjects and SetImpactedByFloatingObjects

Lines

See GetLines

XMLNodeName

See GetXMLNodeName


api Class API

class wx.richtext.RichTextParagraph(RichTextCompositeObject)

Possible constructors:

RichTextParagraph(parent: Optional[RichTextObject]=None, style:
                  Optional[RichTextAttr]=None) -> None

RichTextParagraph(text : str, parent: Optional[RichTextObject]=None,
                  paraStyle: Optional[RichTextAttr]=None, charStyle:
                  Optional[RichTextAttr]=None) -> None

RichTextParagraph(obj : RichTextParagraph) -> None

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


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, parent: Optional[RichTextObject]=None, style: Optional[RichTextAttr]=None)

Constructor taking a parent and style.

Parameters:
Return type:

None



__init__ (self, text : str, parent: Optional[RichTextObject]=None, paraStyle: Optional[RichTextAttr]=None, charStyle: Optional[RichTextAttr]=None)

Constructor taking a text string, a parent and paragraph and character attributes.

Parameters:
Return type:

None



__init__ (self, obj : RichTextParagraph)

Parameters:

obj (wx.richtext.RichTextParagraph) –

Return type:

None





AllocateLine(self, pos : int)

Allocates or reuses a line object.

Parameters:

pos (int) –

Return type:

wx.richtext.RichTextLine



ApplyParagraphStyle(self, line : RichTextLine, attr : RichTextAttr, rect : Rect, dc : DC)

Applies paragraph styles such as centering to the wrapped lines.

Parameters:
Return type:

None



CalculateRange(self, start : int)

Calculates the range of the object.

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

Parameters:

start (long) –

Return type:

int



static ClearDefaultTabs()

Clears the default tabstop array.

Return type:

None



ClearLines(self)

Clears the cached lines.

Return type:

None



ClearUnusedLines(self, lineCount : int)

Clears remaining unused line objects, if any.

Parameters:

lineCount (int) –

Return type:

bool



Clone(self)

Clones the object.

Return type:

wx.richtext.RichTextObject



Copy(self, obj : RichTextParagraph)

Copies the object.

Parameters:

obj (wx.richtext.RichTextParagraph) –

Return type:

None



Draw(self, dc : DC, context : RichTextDrawingContext, range : RichTextRange, selection : RichTextSelection, rect : Rect, descent : int, style : int)

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)

Parameters:
Return type:

bool



FindObjectAtPosition(self, position : int)

Finds the object at the given position.

Parameters:

position (long) –

Return type:

wx.richtext.RichTextObject



FindPosition(self, dc : DC, context : RichTextDrawingContext, index : int, forceLineStart : bool)

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

Parameters:
Return type:

le[bool, wx.Point, int]



FindWrapPosition(self, range : RichTextRange, dc : DC, context : RichTextDrawingContext, availableSpace : int, wrapPosition : int, partialExtents : List[int])

Finds a suitable wrap position.

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

Parameters:
Return type:

bool



GetBulletText(self)

Returns the bullet text for this paragraph.

Return type:

str



GetCombinedAttributes(self, *args, **kw)

overload Overloaded Implementations:



GetCombinedAttributes (self, contentStyle : RichTextAttr, includingBoxAttr: bool=False)

Returns combined attributes of the base style, paragraph style and character style.

We use this to dynamically retrieve the actual style.

Parameters:
Return type:

wx.richtext.RichTextAttr



GetCombinedAttributes (self, includingBoxAttr: bool=False)

Returns the combined attributes of the base style and paragraph style.

Parameters:

includingBoxAttr (bool) –

Return type:

wx.richtext.RichTextAttr





GetContiguousPlainText(self, text : str, range : RichTextRange, fromStart: bool=True)

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

The resulting string may be shorter than the range given.

Parameters:
Return type:

bool



static GetDefaultTabs()

Returns the default tabstop array.

Return type:

List[int]



GetFirstLineBreakPosition(self, pos : int)

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

Parameters:

pos (long) –

Return type:

int



GetImpactedByFloatingObjects(self)

Whether the paragraph is impacted by floating objects from above.

Return type:

int



GetLines(self)

Returns the cached lines.

Return type:

Any



GetRangeSize(self, range : RichTextRange, size : Size, descent : int, dc : DC, context : RichTextDrawingContext, flags : int, position: Point=Point(0, 0), parentSize: Size=DefaultSize, partialExtents: Optional[List[int]]=None)

Returns the object size for the given range.

Returns False if the range is invalid for this object.

Parameters:
Return type:

bool



GetXMLNodeName(self)

Returns the XML node name of this object.

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

Return type:

str



HitTest(self, dc : DC, context : RichTextDrawingContext, pt : Point, flags: int=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).

Parameters:
Return type:

Tuple[int, int, RichTextObject, RichTextObject]

Returns:

One of the wx.richtext.RichTextHitTestFlags values.



Init(self)
Return type:

None



static InitDefaultTabs()

Creates a default tabstop array.

Return type:

None



InsertText(self, pos : int, text : str)

Inserts text at the given position.

Parameters:
  • pos (long) –

  • text (string) –

Return type:

bool



Layout(self, dc : DC, context : RichTextDrawingContext, rect : Rect, parentRect : Rect, style : int)

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).

Parameters:
Return type:

bool



LayoutFloat(self, dc : DC, context : RichTextDrawingContext, rect : Rect, parentRect : Rect, style : int, floatCollector : RichTextFloatCollector)

Lays out the floating objects.

Parameters:
Return type:

None



MoveFromList(self, list : RichTextObjectList_)

Adds content back from a list.

Parameters:

list (RichTextObjectList_) –

Return type:

None



MoveToList(self, obj : RichTextObject, list : RichTextObjectList_)

Moves content to a list from this point.

Parameters:
Return type:

None



SetImpactedByFloatingObjects(self, i : int)

Sets whether the paragraph is impacted by floating objects from above.

Parameters:

i (int) –

Return type:

None



SplitAt(self, pos : int, previousObject: Optional[RichTextObject]=None)

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

Parameters:
Return type:

wx.richtext.RichTextObject


Properties

BulletText

See GetBulletText



CombinedAttributes

See GetCombinedAttributes



ImpactedByFloatingObjects

See GetImpactedByFloatingObjects and SetImpactedByFloatingObjects



Lines

See GetLines



XMLNodeName

See GetXMLNodeName