.. 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.RichTextParagraphLayoutBox: ========================================================================================================================================== |phoenix_title| **wx.richtext.RichTextParagraphLayoutBox** ========================================================================================================================================== This class knows how to lay out paragraphs. .. seealso:: :ref:`wx.richtext.RichTextCompositeObject`, :ref:`wx.richtext.RichTextObject`, :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextCtrl` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class RichTextParagraphLayoutBox:
| |sub_classes| Known Subclasses ============================== :ref:`wx.richtext.RichTextBox`, :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextField` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.richtext.RichTextParagraphLayoutBox.__init__` :meth:`~wx.richtext.RichTextParagraphLayoutBox.AcceptsFocus` Returns ``True`` if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible. :meth:`~wx.richtext.RichTextParagraphLayoutBox.AddImage` Convenience function to add an image. :meth:`~wx.richtext.RichTextParagraphLayoutBox.AddParagraph` Convenience function to add a paragraph of text. :meth:`~wx.richtext.RichTextParagraphLayoutBox.AddParagraphs` Adds multiple paragraphs, based on newlines. :meth:`~wx.richtext.RichTextParagraphLayoutBox.ApplyStyleSheet` Apply the style sheet to the buffer, for example if the styles have changed. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Clear` Clears all the children. :meth:`~wx.richtext.RichTextParagraphLayoutBox.ClearListStyle` Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Clone` Clones the object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.CollectStyle` Combines `style` with `currentStyle` for the purpose of summarising the attributes of a range of content. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Copy` :meth:`~wx.richtext.RichTextParagraphLayoutBox.CopyFragment` Make a copy of the fragment corresponding to the given range, putting it in `fragment`. :meth:`~wx.richtext.RichTextParagraphLayoutBox.DeleteRange` Deletes the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.DeleteRangeWithUndo` Submits a command to delete this range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.DoGetStyle` Implementation helper for GetStyle. :meth:`~wx.richtext.RichTextParagraphLayoutBox.DoInvalidate` Do the (in)validation for this object only. :meth:`~wx.richtext.RichTextParagraphLayoutBox.DoNumberList` Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously `def` can be NULL/empty to indicate that the existing list style should be used. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Draw` Draw the item, within the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.DrawFloats` Draws the floating objects in this buffer. :meth:`~wx.richtext.RichTextParagraphLayoutBox.FindNextParagraphNumber` Fills in the attributes for numbering a paragraph after previousParagraph. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetBasicStyle` Returns the basic (overall) style. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetDefaultStyle` Returns the current default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold). :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatCollector` Returns the RichTextFloatCollector of this object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatingObjectCount` Returns the number of floating objects at this level. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatingObjects` Returns a list of floating objects. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetInvalidRange` Get invalid range, rounding to entire paragraphs if argument is ``True``. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLeafObjectAtPosition` Returns the leaf object in a paragraph at this position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineAtPosition` Returns the line at the given position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineAtYPosition` Returns the line at the given y pixel position, or the last line. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineCount` Returns the number of visible lines. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineForVisibleLineNumber` Given a line number, returns the corresponding :ref:`wx.richtext.RichTextLine` object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineSizeAtPosition` Returns the line size at the given position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphAtLine` Returns the paragraph by number. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphAtPosition` Returns the paragraph at the given character or caret position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphCount` Returns the number of paragraphs. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphForLine` Returns the paragraph for a given line. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphLength` Returns the length of the paragraph. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphText` Returns the text of the paragraph. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetPartialParagraph` Returns a flag indicating whether the last paragraph is partial or complete. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetRangeSize` Returns the object size for the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetRichTextCtrl` Returns the associated control. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetStyle` Returns the combined text attributes for this position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetStyleForNewParagraph` Returns the style that is appropriate for a new paragraph at this position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetStyleForRange` This function gets a style representing the common, combined attributes in the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetStyleSheet` Returns the style sheet associated with the overall buffer. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetText` Get all the text. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetTextForRange` Returns any text in this object for the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetUncombinedStyle` Returns the content (uncombined) attributes for this position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetVisibleLineNumber` Given a position, returns the number of the visible line (potentially many to a paragraph), starting from zero at the start of the buffer. :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetXMLNodeName` Returns the ``XML`` node name of this object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.HasCharacterAttributes` Test if this whole range has character attributes of the specified kind. :meth:`~wx.richtext.RichTextParagraphLayoutBox.HasParagraphAttributes` Test if this whole range has paragraph attributes of the specified kind. :meth:`~wx.richtext.RichTextParagraphLayoutBox.HitTest` Hit-testing: returns a flag indicating hit test details, plus information about position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.ImportFromXML` Imports this object from ``XML``. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Init` Initializes the object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertFieldWithUndo` Submits a command to insert the given field. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertFragment` Insert fragment into this box at the given position. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertImageWithUndo` Submits a command to insert the given image. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertNewlineWithUndo` Submits a command to insert the given text. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertObjectWithUndo` Inserts an object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertParagraphsWithUndo` Submits a command to insert paragraphs. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InsertTextWithUndo` Submits a command to insert the given text. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Invalidate` Invalidates the buffer. :meth:`~wx.richtext.RichTextParagraphLayoutBox.InvalidateHierarchy` Do the (in)validation both up and down the hierarchy. :meth:`~wx.richtext.RichTextParagraphLayoutBox.IsDirty` Returns ``True`` if this object needs layout. :meth:`~wx.richtext.RichTextParagraphLayoutBox.IsTopLevel` Returns ``True`` if this object is top-level, i.e. contains its own paragraphs, such as a text box. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Layout` Lay the item out at the specified position with the given size constraint. :meth:`~wx.richtext.RichTextParagraphLayoutBox.MoveAnchoredObjectToParagraph` Moves an anchored object to another paragraph. :meth:`~wx.richtext.RichTextParagraphLayoutBox.NumberList` Numbers the paragraphs in the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.PositionToXY` Converts a zero-based position to line column and paragraph number. :meth:`~wx.richtext.RichTextParagraphLayoutBox.PrepareContent` Prepares the content just before insertion (or after buffer reset). :meth:`~wx.richtext.RichTextParagraphLayoutBox.PromoteList` Promotes the list items within the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.Reset` Clears and initializes with one blank paragraph. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetBasicStyle` Sets the basic (overall) style. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetDefaultStyle` Sets the default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold). :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetListStyle` Sets the list attributes for the given range, passing flags to determine how the attributes are set. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetObjectPropertiesWithUndo` Sets with undo the properties for the given object. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetPartialParagraph` Sets a flag indicating whether the last paragraph is partial or complete. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetProperties` Sets the properties for the given range, passing flags to determine how the attributes are set. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetRichTextCtrl` Associates a control with the buffer, for operations that for example require refreshing the window. :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetStyle` Sets the attributes for the given range. :meth:`~wx.richtext.RichTextParagraphLayoutBox.UpdateFloatingObjects` Gather information about floating objects. :meth:`~wx.richtext.RichTextParagraphLayoutBox.UpdateRanges` Calculate ranges. :meth:`~wx.richtext.RichTextParagraphLayoutBox.XYToPosition` Converts zero-based line column and paragraph number to a position. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.richtext.RichTextParagraphLayoutBox.BasicStyle` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetBasicStyle` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetBasicStyle` :attr:`~wx.richtext.RichTextParagraphLayoutBox.DefaultStyle` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetDefaultStyle` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetDefaultStyle` :attr:`~wx.richtext.RichTextParagraphLayoutBox.FloatCollector` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatCollector` :attr:`~wx.richtext.RichTextParagraphLayoutBox.FloatingObjectCount` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatingObjectCount` :attr:`~wx.richtext.RichTextParagraphLayoutBox.InvalidRange` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetInvalidRange` :attr:`~wx.richtext.RichTextParagraphLayoutBox.LineCount` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineCount` :attr:`~wx.richtext.RichTextParagraphLayoutBox.ParagraphCount` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphCount` :attr:`~wx.richtext.RichTextParagraphLayoutBox.PartialParagraph` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetPartialParagraph` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetPartialParagraph` :attr:`~wx.richtext.RichTextParagraphLayoutBox.RichTextCtrl` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetRichTextCtrl` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetRichTextCtrl` :attr:`~wx.richtext.RichTextParagraphLayoutBox.StyleSheet` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetStyleSheet` :attr:`~wx.richtext.RichTextParagraphLayoutBox.Text` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetText` :attr:`~wx.richtext.RichTextParagraphLayoutBox.XMLNodeName` See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetXMLNodeName` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.richtext.RichTextParagraphLayoutBox(RichTextCompositeObject) **Possible constructors**:: RichTextParagraphLayoutBox(parent=None) RichTextParagraphLayoutBox(obj) This class knows how to lay out paragraphs. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self, parent=None)` :param `parent`: :type `parent`: wx.richtext.RichTextObject :html:`

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

` .. method:: AcceptsFocus(self) Returns ``True`` if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible. For example, containers supporting text, such as a text box object, can accept the focus, but a table can't (set the focus to individual cells instead). :rtype: `bool` .. method:: AddImage(self, image, paraStyle=None) Convenience function to add an image. :param `image`: :type `image`: wx.Image :param `paraStyle`: :type `paraStyle`: wx.richtext.RichTextAttr :rtype: :ref:`wx.richtext.RichTextRange` .. method:: AddParagraph(self, text, paraStyle=None) Convenience function to add a paragraph of text. :param `text`: :type `text`: string :param `paraStyle`: :type `paraStyle`: wx.richtext.RichTextAttr :rtype: :ref:`wx.richtext.RichTextRange` .. method:: AddParagraphs(self, text, paraStyle=None) Adds multiple paragraphs, based on newlines. :param `text`: :type `text`: string :param `paraStyle`: :type `paraStyle`: wx.richtext.RichTextAttr :rtype: :ref:`wx.richtext.RichTextRange` .. method:: ApplyStyleSheet(self, styleSheet) Apply the style sheet to the buffer, for example if the styles have changed. :param `styleSheet`: :type `styleSheet`: wx.richtext.RichTextStyleSheet :rtype: `bool` .. method:: Clear(self) Clears all the children. .. method:: ClearListStyle(self, range, flags=RICHTEXT_SETSTYLE_WITH_UNDO) Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph. `flags` is a bit list of the following: - ``wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO``: specifies that this command will be undoable. :param `range`: :type `range`: wx.richtext.RichTextRange :param `flags`: :type `flags`: int :rtype: `bool` .. seealso:: :meth:`SetListStyle` , :meth:`PromoteList` , :meth:`NumberList` .. method:: Clone(self) Clones the object. :rtype: :ref:`wx.richtext.RichTextObject` .. method:: CollectStyle(self, currentStyle, style, clashingAttr, absentAttr) Combines `style` with `currentStyle` for the purpose of summarising the attributes of a range of content. :param `currentStyle`: :type `currentStyle`: wx.richtext.RichTextAttr :param `style`: :type `style`: wx.richtext.RichTextAttr :param `clashingAttr`: :type `clashingAttr`: wx.richtext.RichTextAttr :param `absentAttr`: :type `absentAttr`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: Copy(self, obj) :param `obj`: :type `obj`: wx.richtext.RichTextParagraphLayoutBox .. method:: CopyFragment(self, range, fragment) Make a copy of the fragment corresponding to the given range, putting it in `fragment`. :param `range`: :type `range`: wx.richtext.RichTextRange :param `fragment`: :type `fragment`: wx.richtext.RichTextParagraphLayoutBox :rtype: `bool` .. method:: DeleteRange(self, range) Deletes the given range. :param `range`: :type `range`: wx.richtext.RichTextRange :rtype: `bool` .. method:: DeleteRangeWithUndo(self, range, ctrl, buffer) Submits a command to delete this range. :param `range`: :type `range`: wx.richtext.RichTextRange :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :rtype: `bool` .. method:: DoGetStyle(self, position, style, combineStyles=True) Implementation helper for GetStyle. If combineStyles is ``True``, combine base, paragraph and context attributes. :param `position`: :type `position`: long :param `style`: :type `style`: wx.richtext.RichTextAttr :param `combineStyles`: :type `combineStyles`: bool :rtype: `bool` .. method:: DoInvalidate(self, invalidRange) Do the (in)validation for this object only. :param `invalidRange`: :type `invalidRange`: wx.richtext.RichTextRange .. method:: DoNumberList(self, range, promotionRange, promoteBy, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously `def` can be NULL/empty to indicate that the existing list style should be used. :param `range`: :type `range`: wx.richtext.RichTextRange :param `promotionRange`: :type `promotionRange`: wx.richtext.RichTextRange :param `promoteBy`: :type `promoteBy`: int :param `styleDef`: :type `styleDef`: wx.richtext.RichTextListStyleDefinition :param `flags`: :type `flags`: int :param `startFrom`: :type `startFrom`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` .. 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:: DrawFloats(self, dc, context, range, selection, rect, descent, style) Draws the floating objects in this buffer. :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 .. method:: FindNextParagraphNumber(self, previousParagraph, attr) Fills in the attributes for numbering a paragraph after previousParagraph. :param `previousParagraph`: :type `previousParagraph`: wx.richtext.RichTextParagraph :param `attr`: :type `attr`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: GetBasicStyle(self) Returns the basic (overall) style. This is the style of the whole buffer before further styles are applied, unlike the default style, which only affects the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold). :rtype: :ref:`wx.richtext.RichTextAttr` .. method:: GetDefaultStyle(self) Returns the current default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold). :rtype: :ref:`wx.richtext.RichTextAttr` .. method:: GetFloatCollector(self) Returns the RichTextFloatCollector of this object. :rtype: `RichTextFloatCollector` .. method:: GetFloatingObjectCount(self) Returns the number of floating objects at this level. :rtype: `int` .. method:: GetFloatingObjects(self, objects) Returns a list of floating objects. :param `objects`: :type `objects`: RichTextObjectList :rtype: `bool` .. method:: GetInvalidRange(self, wholeParagraphs=False) Get invalid range, rounding to entire paragraphs if argument is ``True``. :param `wholeParagraphs`: :type `wholeParagraphs`: bool :rtype: :ref:`wx.richtext.RichTextRange` .. method:: GetLeafObjectAtPosition(self, position) Returns the leaf object in a paragraph at this position. :param `position`: :type `position`: long :rtype: :ref:`wx.richtext.RichTextObject` .. method:: GetLineAtPosition(self, pos, caretPosition=False) Returns the line at the given position. If `caretPosition` is ``True``, the position is a caret position, which is normally a smaller number. :param `pos`: :type `pos`: long :param `caretPosition`: :type `caretPosition`: bool :rtype: :ref:`wx.richtext.RichTextLine` .. method:: GetLineAtYPosition(self, y) Returns the line at the given y pixel position, or the last line. :param `y`: :type `y`: int :rtype: :ref:`wx.richtext.RichTextLine` .. method:: GetLineCount(self) Returns the number of visible lines. :rtype: `int` .. method:: GetLineForVisibleLineNumber(self, lineNumber) Given a line number, returns the corresponding :ref:`wx.richtext.RichTextLine` object. :param `lineNumber`: :type `lineNumber`: long :rtype: :ref:`wx.richtext.RichTextLine` .. method:: GetLineSizeAtPosition(self, pos, caretPosition=False) Returns the line size at the given position. :param `pos`: :type `pos`: long :param `caretPosition`: :type `caretPosition`: bool :rtype: `Size` .. method:: GetParagraphAtLine(self, paragraphNumber) Returns the paragraph by number. :param `paragraphNumber`: :type `paragraphNumber`: long :rtype: :ref:`wx.richtext.RichTextParagraph` .. method:: GetParagraphAtPosition(self, pos, caretPosition=False) Returns the paragraph at the given character or caret position. :param `pos`: :type `pos`: long :param `caretPosition`: :type `caretPosition`: bool :rtype: :ref:`wx.richtext.RichTextParagraph` .. method:: GetParagraphCount(self) Returns the number of paragraphs. :rtype: `int` .. method:: GetParagraphForLine(self, line) Returns the paragraph for a given line. :param `line`: :type `line`: wx.richtext.RichTextLine :rtype: :ref:`wx.richtext.RichTextParagraph` .. method:: GetParagraphLength(self, paragraphNumber) Returns the length of the paragraph. :param `paragraphNumber`: :type `paragraphNumber`: long :rtype: `int` .. method:: GetParagraphText(self, paragraphNumber) Returns the text of the paragraph. :param `paragraphNumber`: :type `paragraphNumber`: long :rtype: `string` .. method:: GetPartialParagraph(self) Returns a flag indicating whether the last paragraph is partial or complete. :rtype: `bool` .. 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:: GetRichTextCtrl(self) Returns the associated control. :rtype: :ref:`wx.richtext.RichTextCtrl` .. method:: GetStyle(self, position, style) Returns the combined text attributes for this position. This function gets the `uncombined` style - that is, the attributes associated with the paragraph or character content, and not necessarily the combined attributes you see on the screen. To get the combined attributes, use :meth:`GetStyle` . If you specify (any) paragraph attribute in `style's` flags, this function will fetch the paragraph attributes. Otherwise, it will return the character attributes. :param `position`: :type `position`: long :param `style`: :type `style`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: GetStyleForNewParagraph(self, buffer, pos, caretPosition=False, lookUpNewParaStyle=False) Returns the style that is appropriate for a new paragraph at this position. If the previous paragraph has a paragraph style name, looks up the next-paragraph style. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `caretPosition`: :type `caretPosition`: bool :param `lookUpNewParaStyle`: :type `lookUpNewParaStyle`: bool :rtype: :ref:`wx.richtext.RichTextAttr` .. method:: GetStyleForRange(self, range, style) This function gets a style representing the common, combined attributes in the given range. Attributes which have different values within the specified range will not be included the style flags. The function is used to get the attributes to display in the formatting dialog: the user can edit the attributes common to the selection, and optionally specify the values of further attributes to be applied uniformly. To apply the edited attributes, you can use :meth:`SetStyle` specifying the ``wx.richtext.RICHTEXT_SETSTYLE_OPTIMIZE`` flag, which will only apply attributes that are different from the `combined` attributes within the range. So, the user edits the effective, displayed attributes for the range, but his choice won't be applied unnecessarily to content. As an example, say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The combined style is bold, and this is what the user will see on-screen and in the formatting dialog. The user now specifies red text, in addition to bold. When applying with :meth:`SetStyle` , the content font weight attributes won't be changed to bold because this is already specified by the paragraph. However the text colour attributes `will` be changed to show red. :param `range`: :type `range`: wx.richtext.RichTextRange :param `style`: :type `style`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: GetStyleSheet(self) Returns the style sheet associated with the overall buffer. :rtype: :ref:`wx.richtext.RichTextStyleSheet` .. method:: GetText(self) Get all the text. :rtype: `string` .. method:: GetTextForRange(self, range) Returns any text in this object for the given range. :param `range`: :type `range`: wx.richtext.RichTextRange :rtype: `string` .. method:: GetUncombinedStyle(self, position, style) Returns the content (uncombined) attributes for this position. :param `position`: :type `position`: long :param `style`: :type `style`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: GetVisibleLineNumber(self, pos, caretPosition=False, startOfLine=False) Given a position, returns the number of the visible line (potentially many to a paragraph), starting from zero at the start of the buffer. We also have to pass a bool (`startOfLine`) that indicates whether the caret is being shown at the end of the previous line or at the start of the next, since the caret can be shown at two visible positions for the same underlying position. :param `pos`: :type `pos`: long :param `caretPosition`: :type `caretPosition`: bool :param `startOfLine`: :type `startOfLine`: bool :rtype: `long` .. 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:: HasCharacterAttributes(self, range, style) Test if this whole range has character attributes of the specified kind. If any of the attributes are different within the range, the test fails. You can use this to implement, for example, bold button updating. style must have flags indicating which attributes are of interest. :param `range`: :type `range`: wx.richtext.RichTextRange :param `style`: :type `style`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: HasParagraphAttributes(self, range, style) Test if this whole range has paragraph attributes of the specified kind. If any of the attributes are different within the range, the test fails. You can use this to implement, for example, centering button updating. style must have flags indicating which attributes are of interest. :param `range`: :type `range`: wx.richtext.RichTextRange :param `style`: :type `style`: wx.richtext.RichTextAttr :rtype: `bool` .. 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:: ImportFromXML(self, buffer, node, handler, recurse) Imports this object from ``XML``. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `node`: :type `node`: wx.xml.XmlNode :param `handler`: :type `handler`: wx.richtext.RichTextXMLHandler :param `recurse`: :type `recurse`: bool :rtype: `bool` .. method:: Init(self) Initializes the object. .. method:: InsertFieldWithUndo(self, buffer, pos, fieldType, properties, ctrl, flags, textAttr) Submits a command to insert the given field. Field data can be included in properties. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `fieldType`: :type `fieldType`: string :param `properties`: :type `properties`: wx.richtext.RichTextProperties :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `flags`: :type `flags`: int :param `textAttr`: :type `textAttr`: wx.richtext.RichTextAttr :rtype: :ref:`wx.richtext.RichTextField` .. seealso:: :ref:`wx.richtext.RichTextField`, :ref:`wx.richtext.RichTextFieldType`, :ref:`wx.richtext.RichTextFieldTypeStandard` .. method:: InsertFragment(self, position, fragment) Insert fragment into this box at the given position. If partialParagraph is ``True``, it is assumed that the last (or only) paragraph is just a piece of data with no paragraph marker. :param `position`: :type `position`: long :param `fragment`: :type `fragment`: wx.richtext.RichTextParagraphLayoutBox :rtype: `bool` .. method:: InsertImageWithUndo(self, buffer, pos, imageBlock, ctrl, flags, textAttr) Submits a command to insert the given image. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `imageBlock`: :type `imageBlock`: wx.richtext.RichTextImageBlock :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `flags`: :type `flags`: int :param `textAttr`: :type `textAttr`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: InsertNewlineWithUndo(self, buffer, pos, ctrl, flags=0) Submits a command to insert the given text. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `flags`: :type `flags`: int :rtype: `bool` .. method:: InsertObjectWithUndo(self, buffer, pos, object, ctrl, flags=0) Inserts an object. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `object`: :type `object`: wx.richtext.RichTextObject :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `flags`: :type `flags`: int :rtype: :ref:`wx.richtext.RichTextObject` .. method:: InsertParagraphsWithUndo(self, buffer, pos, paragraphs, ctrl, flags=0) Submits a command to insert paragraphs. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `paragraphs`: :type `paragraphs`: wx.richtext.RichTextParagraphLayoutBox :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `flags`: :type `flags`: int :rtype: `bool` .. method:: InsertTextWithUndo(self, buffer, pos, text, ctrl, flags=0) Submits a command to insert the given text. :param `buffer`: :type `buffer`: wx.richtext.RichTextBuffer :param `pos`: :type `pos`: long :param `text`: :type `text`: string :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl :param `flags`: :type `flags`: int :rtype: `bool` .. method:: Invalidate(self, invalidRange=RICHTEXT_ALL) Invalidates the buffer. With no argument, invalidates whole buffer. :param `invalidRange`: :type `invalidRange`: wx.richtext.RichTextRange .. method:: InvalidateHierarchy(self, invalidRange=RICHTEXT_ALL) Do the (in)validation both up and down the hierarchy. :param `invalidRange`: :type `invalidRange`: wx.richtext.RichTextRange .. method:: IsDirty(self) Returns ``True`` if this object needs layout. :rtype: `bool` .. method:: IsTopLevel(self) Returns ``True`` if this object is top-level, i.e. contains its own paragraphs, such as a text box. :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:: MoveAnchoredObjectToParagraph(self, from_, to_, obj) Moves an anchored object to another paragraph. :param `from_`: :type `from_`: wx.richtext.RichTextParagraph :param `to_`: :type `to_`: wx.richtext.RichTextParagraph :param `obj`: :type `obj`: wx.richtext.RichTextObject .. method:: NumberList(self, *args, **kw) Numbers the paragraphs in the given range. Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed. `flags` is a bit list of the following: - ``wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO``: specifies that this command will be undoable. - ``wx.richtext.RICHTEXT_SETSTYLE_RENUMBER``: specifies that numbering should start from `startFrom`, otherwise existing attributes are used. - ``wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL``: specifies that `listLevel` should be used as the level for all paragraphs, otherwise the current indentation will be used. `def` can be ``None`` to indicate that the existing list style should be used. .. seealso:: :meth:`SetListStyle` , :meth:`PromoteList` , :meth:`ClearListStyle` |overload| Overloaded Implementations: :html:`

` **NumberList** `(self, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)` :param `range`: :type `range`: wx.richtext.RichTextRange :param `def`: :type `def`: wx.richtext.RichTextListStyleDefinition :param `flags`: :type `flags`: int :param `startFrom`: :type `startFrom`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` :html:`

` **NumberList** `(self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)` :param `range`: :type `range`: wx.richtext.RichTextRange :param `defName`: :type `defName`: string :param `flags`: :type `flags`: int :param `startFrom`: :type `startFrom`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` :html:`

` .. method:: PositionToXY(self, pos, x, y) Converts a zero-based position to line column and paragraph number. :param `pos`: :type `pos`: long :param `x`: :type `x`: long :param `y`: :type `y`: long :rtype: `bool` .. method:: PrepareContent(self, container) Prepares the content just before insertion (or after buffer reset). Currently is only called if undo mode is on. :param `container`: :type `container`: wx.richtext.RichTextParagraphLayoutBox .. method:: PromoteList(self, *args, **kw) Promotes the list items within the given range. A positive `promoteBy` produces a smaller indent, and a negative number produces a larger indent. Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed. `flags` is a bit list of the following: - ``wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO``: specifies that this command will be undoable. - ``wx.richtext.RICHTEXT_SETSTYLE_RENUMBER``: specifies that numbering should start from `startFrom`, otherwise existing attributes are used. - ``wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL``: specifies that `listLevel` should be used as the level for all paragraphs, otherwise the current indentation will be used. .. seealso:: :meth:`SetListStyle` , :meth:`SetListStyle` , :meth:`ClearListStyle` |overload| Overloaded Implementations: :html:`

` **PromoteList** `(self, promoteBy, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)` :param `promoteBy`: :type `promoteBy`: int :param `range`: :type `range`: wx.richtext.RichTextRange :param `def`: :type `def`: wx.richtext.RichTextListStyleDefinition :param `flags`: :type `flags`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` :html:`

` **PromoteList** `(self, promoteBy, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)` :param `promoteBy`: :type `promoteBy`: int :param `range`: :type `range`: wx.richtext.RichTextRange :param `defName`: :type `defName`: string :param `flags`: :type `flags`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` :html:`

` .. method:: Reset(self) Clears and initializes with one blank paragraph. .. method:: SetBasicStyle(self, style) Sets the basic (overall) style. This is the style of the whole buffer before further styles are applied, unlike the default style, which only affects the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold). :param `style`: :type `style`: wx.richtext.RichTextAttr .. method:: SetDefaultStyle(self, style) Sets the default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold). This is not cumulative - setting the default style will replace the previous default style. Setting it to a default attribute object makes new content take on the 'basic' style. :param `style`: :type `style`: wx.richtext.RichTextAttr :rtype: `bool` .. method:: SetListStyle(self, *args, **kw) Sets the list attributes for the given range, passing flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed. `flags` is a bit list of the following: - ``wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO``: specifies that this command will be undoable. - ``wx.richtext.RICHTEXT_SETSTYLE_RENUMBER``: specifies that numbering should start from `startFrom`, otherwise existing attributes are used. - ``wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL``: specifies that `listLevel` should be used as the level for all paragraphs, otherwise the current indentation will be used. .. seealso:: :meth:`NumberList` , :meth:`PromoteList` , :meth:`ClearListStyle` . |overload| Overloaded Implementations: :html:`

` **SetListStyle** `(self, range, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)` :param `range`: :type `range`: wx.richtext.RichTextRange :param `styleDef`: :type `styleDef`: wx.richtext.RichTextListStyleDefinition :param `flags`: :type `flags`: int :param `startFrom`: :type `startFrom`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` :html:`

` **SetListStyle** `(self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)` :param `range`: :type `range`: wx.richtext.RichTextRange :param `defName`: :type `defName`: string :param `flags`: :type `flags`: int :param `startFrom`: :type `startFrom`: int :param `specifiedLevel`: :type `specifiedLevel`: int :rtype: `bool` :html:`

` .. method:: SetObjectPropertiesWithUndo(self, obj, properties, objToSet=None) Sets with undo the properties for the given object. :param `obj`: :type `obj`: wx.richtext.RichTextObject :param `properties`: :type `properties`: wx.richtext.RichTextProperties :param `objToSet`: :type `objToSet`: wx.richtext.RichTextObject :rtype: `bool` .. method:: SetPartialParagraph(self, partialPara) Sets a flag indicating whether the last paragraph is partial or complete. :param `partialPara`: :type `partialPara`: bool .. method:: SetProperties(self, range, properties, flags=RICHTEXT_SETPROPERTIES_WITH_UNDO) Sets the properties for the given range, passing flags to determine how the attributes are set. You can merge properties or replace them. The end point of range is specified as the last character position of the span of text, plus one. So, for example, to set the properties for a character at position 5, use the range (5,6). `flags` may contain a bit list of the following values: - ``wx.richtext.RICHTEXT_SETPROPERTIES_NONE``: no flag. - ``wx.richtext.RICHTEXT_SETPROPERTIES_WITH_UNDO``: specifies that this operation should be undoable. - ``wx.richtext.RICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY``: specifies that the properties should only be applied to paragraphs, and not the content. - ``wx.richtext.RICHTEXT_SETPROPERTIES_CHARACTERS_ONLY``: specifies that the properties should only be applied to characters, and not the paragraph. - ``wx.richtext.RICHTEXT_SETPROPERTIES_RESET``: resets (clears) the existing properties before applying the new properties. - ``wx.richtext.RICHTEXT_SETPROPERTIES_REMOVE``: removes the specified properties. :param `range`: :type `range`: wx.richtext.RichTextRange :param `properties`: :type `properties`: wx.richtext.RichTextProperties :param `flags`: :type `flags`: int :rtype: `bool` .. method:: SetRichTextCtrl(self, ctrl) Associates a control with the buffer, for operations that for example require refreshing the window. :param `ctrl`: :type `ctrl`: wx.richtext.RichTextCtrl .. method:: SetStyle(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **SetStyle** `(self, range, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO)` Sets the attributes for the given range. Pass flags to determine how the attributes are set. The end point of range is specified as the last character position of the span of text. So, for example, to set the style for a character at position 5, use the range (5,5). This differs from the :ref:`wx.richtext.RichTextCtrl` API, where you would specify (5,6). `flags` may contain a bit list of the following values: - ``wx.richtext.RICHTEXT_SETSTYLE_NONE``: no style flag. - ``wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO``: specifies that this operation should be undoable. - ``wx.richtext.RICHTEXT_SETSTYLE_OPTIMIZE``: specifies that the style should not be applied if the combined style at this point is already the style in question. - ``wx.richtext.RICHTEXT_SETSTYLE_PARAGRAPHS_ONLY``: specifies that the style should only be applied to paragraphs, and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style. - ``wx.richtext.RICHTEXT_SETSTYLE_CHARACTERS_ONLY``: specifies that the style should only be applied to characters, and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style. - ``wx.richtext.RICHTEXT_SETSTYLE_RESET``: resets (clears) the existing style before applying the new style. - ``wx.richtext.RICHTEXT_SETSTYLE_REMOVE``: removes the specified style. Only the style flags are used in this operation. :param `range`: :type `range`: wx.richtext.RichTextRange :param `style`: :type `style`: wx.richtext.RichTextAttr :param `flags`: :type `flags`: int :rtype: `bool` :html:`

` **SetStyle** `(self, obj, textAttr, flags=RICHTEXT_SETSTYLE_WITH_UNDO)` Sets the attributes for the given object only, for example the box attributes for a text box. :param `obj`: :type `obj`: wx.richtext.RichTextObject :param `textAttr`: :type `textAttr`: wx.richtext.RichTextAttr :param `flags`: :type `flags`: int :html:`

` .. method:: UpdateFloatingObjects(self, availableRect, untilObj=None) Gather information about floating objects. If untilObj is not ``None``, will stop getting information if the current object is this, since we will collect the rest later. :param `availableRect`: :type `availableRect`: wx.Rect :param `untilObj`: :type `untilObj`: wx.richtext.RichTextObject :rtype: `bool` .. method:: UpdateRanges(self) Calculate ranges. .. method:: XYToPosition(self, x, y) Converts zero-based line column and paragraph number to a position. :param `x`: :type `x`: long :param `y`: :type `y`: long :rtype: `long` .. attribute:: BasicStyle See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetBasicStyle` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetBasicStyle` .. attribute:: DefaultStyle See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetDefaultStyle` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetDefaultStyle` .. attribute:: FloatCollector See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatCollector` .. attribute:: FloatingObjectCount See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetFloatingObjectCount` .. attribute:: InvalidRange See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetInvalidRange` .. attribute:: LineCount See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetLineCount` .. attribute:: ParagraphCount See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetParagraphCount` .. attribute:: PartialParagraph See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetPartialParagraph` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetPartialParagraph` .. attribute:: RichTextCtrl See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetRichTextCtrl` and :meth:`~wx.richtext.RichTextParagraphLayoutBox.SetRichTextCtrl` .. attribute:: StyleSheet See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetStyleSheet` .. attribute:: Text See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetText` .. attribute:: XMLNodeName See :meth:`~wx.richtext.RichTextParagraphLayoutBox.GetXMLNodeName`