Phoenix Logo

phoenix_title wx.richtext.RichTextParagraph

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


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.
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.
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.
SplitAt Splits an object at this position if necessary, and returns the previous object, or None if inserting at the beginning.

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.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, parent=None, style=None)

Constructor taking a parent and style.

Parameters:



__init__ (self, text, parent=None, paraStyle=None, charStyle=None)

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

Parameters:



__init__ (self, obj)

Parameters:obj (wx.richtext.RichTextParagraph) –





AllocateLine(self, pos)

Allocates or reuses a line object.

Parameters:pos (int) –
Return type: wx.richtext.RichTextLine


ApplyParagraphStyle(self, line, attr, rect, dc)

Applies paragraph styles such as centering to the wrapped lines.

Parameters:


CalculateRange(self, start)

Calculates the range of the object.

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

Parameters:start (long) –
Return type:end


static ClearDefaultTabs()

Clears the default tabstop array.



ClearLines(self)

Clears the cached lines.



ClearUnusedLines(self, lineCount)

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)

Copies the object.

Parameters:obj (wx.richtext.RichTextParagraph) –


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)

Parameters:
Return type:

bool



FindObjectAtPosition(self, position)

Finds the object at the given position.

Parameters:position (long) –
Return type: wx.richtext.RichTextObject


FindPosition(self, dc, context, index, forceLineStart)

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

Parameters:
Return type:

tuple

Returns:

( bool, pt, height )



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.

Parameters:
Return type:

bool



GetBulletText(self)

Returns the bullet text for this paragraph.

Return type:string


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.

Parameters:
Return type:

wx.richtext.RichTextAttr



GetCombinedAttributes (self, includingBoxAttr=False)

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

Parameters:includingBoxAttr (bool) –
Return type: wx.richtext.RichTextAttr





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.

Parameters:
Return type:

bool



static GetDefaultTabs()

Returns the default tabstop array.

Return type:list of integers


GetFirstLineBreakPosition(self, pos)

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

Parameters:pos (long) –
Return type:long


GetLines(self)

Returns the cached lines.

Return type:RichTextLineList


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.

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:string


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

Parameters:
Return type:

tuple

Returns:

( int, textPosition, obj, contextObj )



static InitDefaultTabs()

Creates a default tabstop array.



InsertText(self, pos, text)

Inserts text at the given position.

Parameters:
  • pos (long) –
  • text (string) –
Return type:

bool



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

Parameters:
Return type:

bool



LayoutFloat(self, dc, context, rect, parentRect, style, floatCollector)

Lays out the floating objects.

Parameters:


MoveFromList(self, list)

Adds content back from a list.

Parameters:list (RichTextObjectList_) –


MoveToList(self, obj, list)

Moves content to a list from this point.

Parameters:


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.

Parameters:
Return type:

wx.richtext.RichTextObject


Properties



BulletText

See GetBulletText



CombinedAttributes

See GetCombinedAttributes



Lines

See GetLines



XMLNodeName

See GetXMLNodeName