.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 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
Inheritance diagram for class RichTextParagraph:
| |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.GetImpactedByFloatingObjects` Whether the paragraph is impacted by floating objects from above. :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.Init` :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.SetImpactedByFloatingObjects` Sets whether the paragraph is impacted by floating objects from above. :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.ImpactedByFloatingObjects` See :meth:`~wx.richtext.RichTextParagraph.GetImpactedByFloatingObjects` and :meth:`~wx.richtext.RichTextParagraph.SetImpactedByFloatingObjects` :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: :html:`

` **__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 :html:`

` **__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 :html:`

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

` .. 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: :html:`

` **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` :html:`

` **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` :html:`

` .. 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:: GetImpactedByFloatingObjects(self) Whether the paragraph is impacted by floating objects from above. :rtype: `int` .. method:: GetLines(self) Returns the cached lines. :rtype: `PyObject` .. 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` ) .. method:: Init(self) .. 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:: SetImpactedByFloatingObjects(self, i) Sets whether the paragraph is impacted by floating objects from above. :param `i`: :type `i`: int .. 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:: ImpactedByFloatingObjects See :meth:`~wx.richtext.RichTextParagraph.GetImpactedByFloatingObjects` and :meth:`~wx.richtext.RichTextParagraph.SetImpactedByFloatingObjects` .. attribute:: Lines See :meth:`~wx.richtext.RichTextParagraph.GetLines` .. attribute:: XMLNodeName See :meth:`~wx.richtext.RichTextParagraph.GetXMLNodeName`