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
Constructor taking a parent and style. |
|
Allocates or reuses a line object. |
|
Applies paragraph styles such as centering to the wrapped lines. |
|
Calculates the range of the object. |
|
Clears the default tabstop array. |
|
Clears the cached lines. |
|
Clears remaining unused line objects, if any. |
|
Clones the object. |
|
Copies the object. |
|
Draw the item, within the given range. |
|
Finds the object at the given position. |
|
Finds the absolute position and row height for the given character position. |
|
Finds a suitable wrap position. |
|
Returns the bullet text for this paragraph. |
|
Returns combined attributes of the base style, paragraph style and character style. |
|
Returns the plain text searching from the start or end of the range. |
|
Returns the default tabstop array. |
|
Returns the first position from pos that has a line break character. |
|
Whether the paragraph is impacted by floating objects from above. |
|
Returns the cached lines. |
|
Returns the object size for the given range. |
|
Returns the |
|
Hit-testing: returns a flag indicating hit test details, plus information about position. |
|
Creates a default tabstop array. |
|
Inserts text at the given position. |
|
Lay the item out at the specified position with the given size constraint. |
|
Lays out the floating objects. |
|
Adds content back from a list. |
|
Moves content to a list from this point. |
|
Sets whether the paragraph is impacted by floating objects from above. |
|
Splits an object at this position if necessary, and returns the previous object, or |
See |
|
See |
|
See |
|
See |
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.
__init__
(self, *args, **kw)¶__init__ (self, parent=None, style=None)
Constructor taking a parent and style.
parent (wx.richtext.RichTextObject) –
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.
text (string) –
parent (wx.richtext.RichTextObject) –
paraStyle (wx.richtext.RichTextAttr) –
charStyle (wx.richtext.RichTextAttr) –
__init__ (self, obj)
obj (wx.richtext.RichTextParagraph) –
AllocateLine
(self, pos)¶Allocates or reuses a line object.
pos (int) –
ApplyParagraphStyle
(self, line, attr, rect, dc)¶Applies paragraph styles such as centering to the wrapped lines.
line (wx.richtext.RichTextLine) –
attr (wx.richtext.RichTextAttr) –
rect (wx.Rect) –
dc (wx.DC) –
CalculateRange
(self, start)¶Calculates the range of the object.
By default, guess that the object is 1 unit long.
start (long) –
end
ClearDefaultTabs
()¶Clears the default tabstop array.
ClearLines
(self)¶Clears the cached lines.
ClearUnusedLines
(self, lineCount)¶Clears remaining unused line objects, if any.
lineCount (int) –
bool
Clone
(self)¶Clones the object.
Copy
(self, obj)¶Copies the object.
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)
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
range (wx.richtext.RichTextRange) –
selection (wx.richtext.RichTextSelection) –
rect (wx.Rect) –
descent (int) –
style (int) –
bool
FindObjectAtPosition
(self, position)¶Finds the object at the given position.
position (long) –
FindPosition
(self, dc, context, index, forceLineStart)¶Finds the absolute position and row height for the given character position.
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
index (long) –
forceLineStart (bool) –
tuple
( 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.
range (wx.richtext.RichTextRange) –
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
availableSpace (int) –
wrapPosition (long) –
partialExtents (list of integers) –
bool
GetBulletText
(self)¶Returns the bullet text for this paragraph.
string
GetCombinedAttributes
(self, *args, **kw)¶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.
contentStyle (wx.richtext.RichTextAttr) –
includingBoxAttr (bool) –
GetCombinedAttributes (self, includingBoxAttr=False)
Returns the combined attributes of the base style and paragraph style.
includingBoxAttr (bool) –
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.
text (string) –
range (wx.richtext.RichTextRange) –
fromStart (bool) –
bool
GetDefaultTabs
()¶Returns the default tabstop array.
list of integers
GetFirstLineBreakPosition
(self, pos)¶Returns the first position from pos that has a line break character.
pos (long) –
long
GetImpactedByFloatingObjects
(self)¶Whether the paragraph is impacted by floating objects from above.
int
GetLines
(self)¶Returns the cached lines.
PyObject
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.
range (wx.richtext.RichTextRange) –
size (wx.Size) –
descent (int) –
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
flags (int) –
position (wx.Point) –
parentSize (wx.Size) –
partialExtents (list of integers) –
bool
GetXMLNodeName
(self)¶Returns the XML
node name of this object.
This must be overridden for XmlNode-base XML
export to work.
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).
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
pt (wx.Point) –
flags (int) –
tuple
( int, textPosition, obj, contextObj )
Init
(self)¶InitDefaultTabs
()¶Creates a default tabstop array.
InsertText
(self, pos, text)¶Inserts text at the given position.
pos (long) –
text (string) –
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).
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
rect (wx.Rect) –
parentRect (wx.Rect) –
style (int) –
bool
LayoutFloat
(self, dc, context, rect, parentRect, style, floatCollector)¶Lays out the floating objects.
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
rect (wx.Rect) –
parentRect (wx.Rect) –
style (int) –
floatCollector (RichTextFloatCollector) –
MoveFromList
(self, list)¶Adds content back from a list.
list (RichTextObjectList_
) –
MoveToList
(self, obj, list)¶Moves content to a list from this point.
obj (wx.richtext.RichTextObject) –
list (RichTextObjectList_
) –
SetImpactedByFloatingObjects
(self, i)¶Sets whether the paragraph is impacted by floating objects from above.
i (int) –
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.
pos (long) –
previousObject (RichTextObject) –
BulletText
¶See GetBulletText
CombinedAttributes
¶ImpactedByFloatingObjects
¶See GetImpactedByFloatingObjects
and SetImpactedByFloatingObjects
XMLNodeName
¶See GetXMLNodeName