Phoenix Logo

phoenix_title wx.richtext.RichTextParagraphLayoutBox

This class knows how to lay out paragraphs.


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextParagraphLayoutBox:


method_summary Methods Summary

__init__  
AcceptsFocus Returns True if objects of this class can accept the focus, i.e. a call to SetFocusObject is possible.
AddImage Convenience function to add an image.
AddParagraph Convenience function to add a paragraph of text.
AddParagraphs Adds multiple paragraphs, based on newlines.
ApplyStyleSheet Apply the style sheet to the buffer, for example if the styles have changed.
Clear Clears all the children.
ClearListStyle Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
Clone Clones the object.
CollectStyle Combines style with currentStyle for the purpose of summarising the attributes of a range of content.
Copy  
CopyFragment Make a copy of the fragment corresponding to the given range, putting it in fragment.
DeleteRange Deletes the given range.
DeleteRangeWithUndo Submits a command to delete this range.
DoGetStyle Implementation helper for GetStyle.
DoInvalidate Do the (in)validation for this object only.
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.
Draw Draw the item, within the given range.
DrawFloats Draws the floating objects in this buffer.
FindNextParagraphNumber Fills in the attributes for numbering a paragraph after previousParagraph.
GetBasicStyle Returns the basic (overall) style.
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).
GetFloatCollector Returns the RichTextFloatCollector of this object.
GetFloatingObjectCount Returns the number of floating objects at this level.
GetFloatingObjects Returns a list of floating objects.
GetInvalidRange Get invalid range, rounding to entire paragraphs if argument is True.
GetLeafObjectAtPosition Returns the leaf object in a paragraph at this position.
GetLineAtPosition Returns the line at the given position.
GetLineAtYPosition Returns the line at the given y pixel position, or the last line.
GetLineCount Returns the number of visible lines.
GetLineForVisibleLineNumber Given a line number, returns the corresponding wx.richtext.RichTextLine object.
GetLineSizeAtPosition Returns the line size at the given position.
GetParagraphAtLine Returns the paragraph by number.
GetParagraphAtPosition Returns the paragraph at the given character or caret position.
GetParagraphCount Returns the number of paragraphs.
GetParagraphForLine Returns the paragraph for a given line.
GetParagraphLength Returns the length of the paragraph.
GetParagraphText Returns the text of the paragraph.
GetPartialParagraph Returns a flag indicating whether the last paragraph is partial or complete.
GetRangeSize Returns the object size for the given range.
GetRichTextCtrl Returns the associated control.
GetStyle Returns the combined text attributes for this position.
GetStyleForNewParagraph Returns the style that is appropriate for a new paragraph at this position.
GetStyleForRange This function gets a style representing the common, combined attributes in the given range.
GetStyleSheet Returns the style sheet associated with the overall buffer.
GetText Get all the text.
GetTextForRange Returns any text in this object for the given range.
GetUncombinedStyle Returns the content (uncombined) attributes for this position.
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.
GetXMLNodeName Returns the XML node name of this object.
HasCharacterAttributes Test if this whole range has character attributes of the specified kind.
HasParagraphAttributes Test if this whole range has paragraph attributes of the specified kind.
HitTest Hit-testing: returns a flag indicating hit test details, plus information about position.
ImportFromXML Imports this object from XML.
Init Initializes the object.
InsertFieldWithUndo Submits a command to insert the given field.
InsertFragment Insert fragment into this box at the given position.
InsertImageWithUndo Submits a command to insert the given image.
InsertNewlineWithUndo Submits a command to insert the given text.
InsertObjectWithUndo Inserts an object.
InsertParagraphsWithUndo Submits a command to insert paragraphs.
InsertTextWithUndo Submits a command to insert the given text.
Invalidate Invalidates the buffer.
InvalidateHierarchy Do the (in)validation both up and down the hierarchy.
IsDirty Returns True if this object needs layout.
IsTopLevel Returns True if this object is top-level, i.e. contains its own paragraphs, such as a text box.
Layout Lay the item out at the specified position with the given size constraint.
MoveAnchoredObjectToParagraph Moves an anchored object to another paragraph.
NumberList Numbers the paragraphs in the given range.
PositionToXY Converts a zero-based position to line column and paragraph number.
PrepareContent Prepares the content just before insertion (or after buffer reset).
PromoteList Promotes the list items within the given range.
Reset Clears and initializes with one blank paragraph.
SetBasicStyle Sets the basic (overall) style.
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).
SetListStyle Sets the list attributes for the given range, passing flags to determine how the attributes are set.
SetObjectPropertiesWithUndo Sets with undo the properties for the given object.
SetPartialParagraph Sets a flag indicating whether the last paragraph is partial or complete.
SetProperties Sets the properties for the given range, passing flags to determine how the attributes are set.
SetRichTextCtrl Associates a control with the buffer, for operations that for example require refreshing the window.
SetStyle Sets the attributes for the given range.
UpdateFloatingObjects Gather information about floating objects.
UpdateRanges Calculate ranges.
XYToPosition Converts zero-based line column and paragraph number to a position.

api Class API



class wx.richtext.RichTextParagraphLayoutBox(RichTextCompositeObject)

Possible constructors:

RichTextParagraphLayoutBox(parent=None)

RichTextParagraphLayoutBox(obj)

This class knows how to lay out paragraphs.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, parent=None)

Parameters:parent (wx.richtext.RichTextObject) –



__init__ (self, obj)

Parameters:obj (wx.richtext.RichTextParagraphLayoutBox) –





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

Return type:bool


AddImage(self, image, paraStyle=None)

Convenience function to add an image.

Parameters:
Return type:

wx.richtext.RichTextRange



AddParagraph(self, text, paraStyle=None)

Convenience function to add a paragraph of text.

Parameters:
Return type:

wx.richtext.RichTextRange



AddParagraphs(self, text, paraStyle=None)

Adds multiple paragraphs, based on newlines.

Parameters:
Return type:

wx.richtext.RichTextRange



ApplyStyleSheet(self, styleSheet)

Apply the style sheet to the buffer, for example if the styles have changed.

Parameters:styleSheet (wx.richtext.RichTextStyleSheet) –
Return type:bool


Clear(self)

Clears all the children.



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.
Parameters:
Return type:

bool



Clone(self)

Clones the object.

Return type: wx.richtext.RichTextObject


CollectStyle(self, currentStyle, style, clashingAttr, absentAttr)

Combines style with currentStyle for the purpose of summarising the attributes of a range of content.

Parameters:
Return type:

bool



Copy(self, obj)
Parameters:obj (wx.richtext.RichTextParagraphLayoutBox) –


CopyFragment(self, range, fragment)

Make a copy of the fragment corresponding to the given range, putting it in fragment.

Parameters:
Return type:

bool



DeleteRange(self, range)

Deletes the given range.

Parameters:range (wx.richtext.RichTextRange) –
Return type:bool


DeleteRangeWithUndo(self, range, ctrl, buffer)

Submits a command to delete this range.

Parameters:
Return type:

bool



DoGetStyle(self, position, style, combineStyles=True)

Implementation helper for GetStyle.

If combineStyles is True, combine base, paragraph and context attributes.

Parameters:
Return type:

bool



DoInvalidate(self, invalidRange)

Do the (in)validation for this object only.

Parameters:invalidRange (wx.richtext.RichTextRange) –


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.

Parameters:
Return type:

bool



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



DrawFloats(self, dc, context, range, selection, rect, descent, style)

Draws the floating objects in this buffer.

Parameters:


FindNextParagraphNumber(self, previousParagraph, attr)

Fills in the attributes for numbering a paragraph after previousParagraph.

Parameters:
Return type:

bool



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

Return type: wx.richtext.RichTextAttr


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

Return type: wx.richtext.RichTextAttr


GetFloatCollector(self)

Returns the RichTextFloatCollector of this object.

Return type:RichTextFloatCollector


GetFloatingObjectCount(self)

Returns the number of floating objects at this level.

Return type:int


GetFloatingObjects(self, objects)

Returns a list of floating objects.

Parameters:objects (RichTextObjectList) –
Return type:bool


GetInvalidRange(self, wholeParagraphs=False)

Get invalid range, rounding to entire paragraphs if argument is True.

Parameters:wholeParagraphs (bool) –
Return type: wx.richtext.RichTextRange


GetLeafObjectAtPosition(self, position)

Returns the leaf object in a paragraph at this position.

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


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.

Parameters:
  • pos (long) –
  • caretPosition (bool) –
Return type:

wx.richtext.RichTextLine



GetLineAtYPosition(self, y)

Returns the line at the given y pixel position, or the last line.

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


GetLineCount(self)

Returns the number of visible lines.

Return type:int


GetLineForVisibleLineNumber(self, lineNumber)

Given a line number, returns the corresponding wx.richtext.RichTextLine object.

Parameters:lineNumber (long) –
Return type: wx.richtext.RichTextLine


GetLineSizeAtPosition(self, pos, caretPosition=False)

Returns the line size at the given position.

Parameters:
  • pos (long) –
  • caretPosition (bool) –
Return type:

Size



GetParagraphAtLine(self, paragraphNumber)

Returns the paragraph by number.

Parameters:paragraphNumber (long) –
Return type: wx.richtext.RichTextParagraph


GetParagraphAtPosition(self, pos, caretPosition=False)

Returns the paragraph at the given character or caret position.

Parameters:
  • pos (long) –
  • caretPosition (bool) –
Return type:

wx.richtext.RichTextParagraph



GetParagraphCount(self)

Returns the number of paragraphs.

Return type:int


GetParagraphForLine(self, line)

Returns the paragraph for a given line.

Parameters:line (wx.richtext.RichTextLine) –
Return type: wx.richtext.RichTextParagraph


GetParagraphLength(self, paragraphNumber)

Returns the length of the paragraph.

Parameters:paragraphNumber (long) –
Return type:int


GetParagraphText(self, paragraphNumber)

Returns the text of the paragraph.

Parameters:paragraphNumber (long) –
Return type:string


GetPartialParagraph(self)

Returns a flag indicating whether the last paragraph is partial or complete.

Return type:bool


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



GetRichTextCtrl(self)

Returns the associated control.

Return type: wx.richtext.RichTextCtrl


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

Parameters:
Return type:

bool



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.

Parameters:
Return type:

wx.richtext.RichTextAttr



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

Parameters:
Return type:

bool



GetStyleSheet(self)

Returns the style sheet associated with the overall buffer.

Return type: wx.richtext.RichTextStyleSheet


GetText(self)

Get all the text.

Return type:string


GetTextForRange(self, range)

Returns any text in this object for the given range.

Parameters:range (wx.richtext.RichTextRange) –
Return type:string


GetUncombinedStyle(self, position, style)

Returns the content (uncombined) attributes for this position.

Parameters:
Return type:

bool



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.

Parameters:
  • pos (long) –
  • caretPosition (bool) –
  • startOfLine (bool) –
Return type:

long



GetXMLNodeName(self)

Returns the XML node name of this object.

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

Return type:string


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.

Parameters:
Return type:

bool



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.

Parameters:
Return type:

bool



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 )



ImportFromXML(self, buffer, node, handler, recurse)

Imports this object from XML.

Parameters:
Return type:

bool



Init(self)

Initializes the object.



InsertFieldWithUndo(self, buffer, pos, fieldType, properties, ctrl, flags, textAttr)

Submits a command to insert the given field.

Field data can be included in properties.

Parameters:
Return type:

wx.richtext.RichTextField



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.

Parameters:
Return type:

bool



InsertImageWithUndo(self, buffer, pos, imageBlock, ctrl, flags, textAttr)

Submits a command to insert the given image.

Parameters:
Return type:

bool



InsertNewlineWithUndo(self, buffer, pos, ctrl, flags=0)

Submits a command to insert the given text.

Parameters:
Return type:

bool



InsertObjectWithUndo(self, buffer, pos, object, ctrl, flags=0)

Inserts an object.

Parameters:
Return type:

wx.richtext.RichTextObject



InsertParagraphsWithUndo(self, buffer, pos, paragraphs, ctrl, flags=0)

Submits a command to insert paragraphs.

Parameters:
Return type:

bool



InsertTextWithUndo(self, buffer, pos, text, ctrl, flags=0)

Submits a command to insert the given text.

Parameters:
Return type:

bool



Invalidate(self, invalidRange=RICHTEXT_ALL)

Invalidates the buffer.

With no argument, invalidates whole buffer.

Parameters:invalidRange (wx.richtext.RichTextRange) –


InvalidateHierarchy(self, invalidRange=RICHTEXT_ALL)

Do the (in)validation both up and down the hierarchy.

Parameters:invalidRange (wx.richtext.RichTextRange) –


IsDirty(self)

Returns True if this object needs layout.

Return type:bool


IsTopLevel(self)

Returns True if this object is top-level, i.e. contains its own paragraphs, such as a text box.

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



MoveAnchoredObjectToParagraph(self, from_, to_, obj)

Moves an anchored object to another paragraph.

Parameters:


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.

overload Overloaded Implementations:



NumberList (self, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters:
Return type:

bool



NumberList (self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters:
Return type:

bool





PositionToXY(self, pos, x, y)

Converts a zero-based position to line column and paragraph number.

Parameters:
  • pos (long) –
  • x (long) –
  • y (long) –
Return type:

bool



PrepareContent(self, container)

Prepares the content just before insertion (or after buffer reset).

Currently is only called if undo mode is on.

Parameters:container (wx.richtext.RichTextParagraphLayoutBox) –


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.

overload Overloaded Implementations:



PromoteList (self, promoteBy, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)

Parameters:
Return type:

bool



PromoteList (self, promoteBy, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)

Parameters:
Return type:

bool





Reset(self)

Clears and initializes with one blank paragraph.



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

Parameters:style (wx.richtext.RichTextAttr) –


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.

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


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.

overload Overloaded Implementations:



SetListStyle (self, range, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters:
Return type:

bool



SetListStyle (self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters:
Return type:

bool





SetObjectPropertiesWithUndo(self, obj, properties, objToSet=None)

Sets with undo the properties for the given object.

Parameters:
Return type:

bool



SetPartialParagraph(self, partialPara)

Sets a flag indicating whether the last paragraph is partial or complete.

Parameters:partialPara (bool) –


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.
Parameters:
Return type:

bool



SetRichTextCtrl(self, ctrl)

Associates a control with the buffer, for operations that for example require refreshing the window.

Parameters:ctrl (wx.richtext.RichTextCtrl) –


SetStyle(self, *args, **kw)

overload Overloaded Implementations:



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 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.
Parameters:
Return type:

bool



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.

Parameters:





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.

Parameters:
Return type:

bool



UpdateRanges(self)

Calculate ranges.



XYToPosition(self, x, y)

Converts zero-based line column and paragraph number to a position.

Parameters:
  • x (long) –
  • y (long) –
Return type:

long


Properties



BasicStyle

See GetBasicStyle and SetBasicStyle



DefaultStyle

See GetDefaultStyle and SetDefaultStyle



FloatCollector

See GetFloatCollector



FloatingObjectCount

See GetFloatingObjectCount



InvalidRange

See GetInvalidRange



LineCount

See GetLineCount



ParagraphCount

See GetParagraphCount



PartialParagraph

See GetPartialParagraph and SetPartialParagraph



RichTextCtrl

See GetRichTextCtrl and SetRichTextCtrl



StyleSheet

See GetStyleSheet



Text

See GetText



XMLNodeName

See GetXMLNodeName