This class knows how to lay out paragraphs.
See also
wx.richtext.RichTextCompositeObject, wx.richtext.RichTextObject, wx.richtext.RichTextBuffer, wx.richtext.RichTextCtrl
wx.richtext.RichTextBox, wx.richtext.RichTextBuffer, wx.richtext.RichTextField
Returns |
|
Convenience function to add an image. |
|
Convenience function to add a paragraph of text. |
|
Adds multiple paragraphs, based on newlines. |
|
Apply the style sheet to the buffer, for example if the styles have changed. |
|
Clears all the children. |
|
Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph. |
|
Clones the object. |
|
Combines style with currentStyle for the purpose of summarising the attributes of a range of content. |
|
Make a copy of the fragment corresponding to the given range, putting it in fragment. |
|
Deletes the given range. |
|
Submits a command to delete this range. |
|
Implementation helper for GetStyle. |
|
Do the (in)validation for this object only. |
|
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 the item, within the given range. |
|
Draws the floating objects in this buffer. |
|
Fills in the attributes for numbering a paragraph after previousParagraph. |
|
Returns the basic (overall) style. |
|
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). |
|
Returns the RichTextFloatCollector of this object. |
|
Returns the number of floating objects at this level. |
|
Returns a list of floating objects. |
|
Get invalid range, rounding to entire paragraphs if argument is |
|
Returns the leaf object in a paragraph at this position. |
|
Returns the line at the given position. |
|
Returns the line at the given y pixel position, or the last line. |
|
Returns the number of visible lines. |
|
Given a line number, returns the corresponding wx.richtext.RichTextLine object. |
|
Returns the line size at the given position. |
|
Returns the paragraph by number. |
|
Returns the paragraph at the given character or caret position. |
|
Returns the number of paragraphs. |
|
Returns the paragraph for a given line. |
|
Returns the length of the paragraph. |
|
Returns the text of the paragraph. |
|
Returns a flag indicating whether the last paragraph is partial or complete. |
|
Returns the object size for the given range. |
|
Returns the associated control. |
|
Returns the combined text attributes for this position. |
|
Returns the style that is appropriate for a new paragraph at this position. |
|
This function gets a style representing the common, combined attributes in the given range. |
|
Returns the style sheet associated with the overall buffer. |
|
Get all the text. |
|
Returns any text in this object for the given range. |
|
Returns the content (uncombined) attributes for this position. |
|
Given a position, returns the number of the visible line (potentially many to a paragraph), starting from zero at the start of the buffer. |
|
Returns the |
|
Test if this whole range has character attributes of the specified kind. |
|
Test if this whole range has paragraph attributes of the specified kind. |
|
Hit-testing: returns a flag indicating hit test details, plus information about position. |
|
Imports this object from |
|
Initializes the object. |
|
Submits a command to insert the given field. |
|
Insert fragment into this box at the given position. |
|
Submits a command to insert the given image. |
|
Submits a command to insert the given text. |
|
Inserts an object. |
|
Submits a command to insert paragraphs. |
|
Submits a command to insert the given text. |
|
Invalidates the buffer. |
|
Do the (in)validation both up and down the hierarchy. |
|
Returns |
|
Returns |
|
Lay the item out at the specified position with the given size constraint. |
|
Moves an anchored object to another paragraph. |
|
Numbers the paragraphs in the given range. |
|
Converts a zero-based position to line column and paragraph number. |
|
Prepares the content just before insertion (or after buffer reset). |
|
Promotes the list items within the given range. |
|
Clears and initializes with one blank paragraph. |
|
Sets the basic (overall) 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). |
|
Sets the list attributes for the given range, passing flags to determine how the attributes are set. |
|
Sets with undo the properties for the given object. |
|
Sets a flag indicating whether the last paragraph is partial or complete. |
|
Sets the properties for the given range, passing flags to determine how the attributes are set. |
|
Associates a control with the buffer, for operations that for example require refreshing the window. |
|
Sets the attributes for the given range. |
|
Gather information about floating objects. |
|
Calculate ranges. |
|
Converts zero-based line column and paragraph number to a position. |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
wx.richtext.
RichTextParagraphLayoutBox
(RichTextCompositeObject)¶Possible constructors:
RichTextParagraphLayoutBox(parent=None)
RichTextParagraphLayoutBox(obj)
This class knows how to lay out paragraphs.
__init__
(self, *args, **kw)¶__init__ (self, parent=None)
parent (wx.richtext.RichTextObject) –
__init__ (self, obj)
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).
bool
AddImage
(self, image, paraStyle=None)¶Convenience function to add an image.
image (wx.Image) –
paraStyle (wx.richtext.RichTextAttr) –
AddParagraph
(self, text, paraStyle=None)¶Convenience function to add a paragraph of text.
text (string) –
paraStyle (wx.richtext.RichTextAttr) –
AddParagraphs
(self, text, paraStyle=None)¶Adds multiple paragraphs, based on newlines.
text (string) –
paraStyle (wx.richtext.RichTextAttr) –
ApplyStyleSheet
(self, styleSheet)¶Apply the style sheet to the buffer, for example if the styles have changed.
styleSheet (wx.richtext.RichTextStyleSheet) –
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.
range (wx.richtext.RichTextRange) –
flags (int) –
bool
See also
Clone
(self)¶Clones the object.
CollectStyle
(self, currentStyle, style, clashingAttr, absentAttr)¶Combines style with currentStyle for the purpose of summarising the attributes of a range of content.
currentStyle (wx.richtext.RichTextAttr) –
style (wx.richtext.RichTextAttr) –
clashingAttr (wx.richtext.RichTextAttr) –
absentAttr (wx.richtext.RichTextAttr) –
bool
Copy
(self, obj)¶CopyFragment
(self, range, fragment)¶Make a copy of the fragment corresponding to the given range, putting it in fragment.
range (wx.richtext.RichTextRange) –
fragment (wx.richtext.RichTextParagraphLayoutBox) –
bool
DeleteRange
(self, range)¶Deletes the given range.
range (wx.richtext.RichTextRange) –
bool
DeleteRangeWithUndo
(self, range, ctrl, buffer)¶Submits a command to delete this range.
range (wx.richtext.RichTextRange) –
ctrl (wx.richtext.RichTextCtrl) –
buffer (wx.richtext.RichTextBuffer) –
bool
DoGetStyle
(self, position, style, combineStyles=True)¶Implementation helper for GetStyle.
If combineStyles is True
, combine base, paragraph and context attributes.
position (long) –
style (wx.richtext.RichTextAttr) –
combineStyles (bool) –
bool
DoInvalidate
(self, invalidRange)¶Do the (in)validation for this object only.
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.
range (wx.richtext.RichTextRange) –
promotionRange (wx.richtext.RichTextRange) –
promoteBy (int) –
styleDef (wx.richtext.RichTextListStyleDefinition) –
flags (int) –
startFrom (int) –
specifiedLevel (int) –
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)
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
range (wx.richtext.RichTextRange) –
selection (wx.richtext.RichTextSelection) –
rect (wx.Rect) –
descent (int) –
style (int) –
bool
DrawFloats
(self, dc, context, range, selection, rect, descent, style)¶Draws the floating objects in this buffer.
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
range (wx.richtext.RichTextRange) –
selection (wx.richtext.RichTextSelection) –
rect (wx.Rect) –
descent (int) –
style (int) –
FindNextParagraphNumber
(self, previousParagraph, attr)¶Fills in the attributes for numbering a paragraph after previousParagraph.
previousParagraph (wx.richtext.RichTextParagraph) –
attr (wx.richtext.RichTextAttr) –
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).
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).
GetFloatCollector
(self)¶Returns the RichTextFloatCollector of this object.
RichTextFloatCollector
GetFloatingObjectCount
(self)¶Returns the number of floating objects at this level.
int
GetFloatingObjects
(self, objects)¶Returns a list of floating objects.
objects (RichTextObjectList) –
bool
GetInvalidRange
(self, wholeParagraphs=False)¶Get invalid range, rounding to entire paragraphs if argument is True
.
wholeParagraphs (bool) –
GetLeafObjectAtPosition
(self, position)¶Returns the leaf object in a paragraph at this position.
position (long) –
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.
pos (long) –
caretPosition (bool) –
GetLineAtYPosition
(self, y)¶Returns the line at the given y pixel position, or the last line.
y (int) –
GetLineCount
(self)¶Returns the number of visible lines.
int
GetLineForVisibleLineNumber
(self, lineNumber)¶Given a line number, returns the corresponding wx.richtext.RichTextLine object.
lineNumber (long) –
GetLineSizeAtPosition
(self, pos, caretPosition=False)¶Returns the line size at the given position.
pos (long) –
caretPosition (bool) –
Size
GetParagraphAtLine
(self, paragraphNumber)¶Returns the paragraph by number.
paragraphNumber (long) –
GetParagraphAtPosition
(self, pos, caretPosition=False)¶Returns the paragraph at the given character or caret position.
pos (long) –
caretPosition (bool) –
GetParagraphCount
(self)¶Returns the number of paragraphs.
int
GetParagraphForLine
(self, line)¶Returns the paragraph for a given line.
line (wx.richtext.RichTextLine) –
GetParagraphLength
(self, paragraphNumber)¶Returns the length of the paragraph.
paragraphNumber (long) –
int
GetParagraphText
(self, paragraphNumber)¶Returns the text of the paragraph.
paragraphNumber (long) –
string
GetPartialParagraph
(self)¶Returns a flag indicating whether the last paragraph is partial or complete.
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.
range (wx.richtext.RichTextRange) –
size (wx.Size) –
descent (int) –
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
flags (int) –
position (wx.Point) –
parentSize (wx.Size) –
partialExtents (list of integers) –
bool
GetRichTextCtrl
(self)¶Returns the associated control.
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.
position (long) –
style (wx.richtext.RichTextAttr) –
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.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
caretPosition (bool) –
lookUpNewParaStyle (bool) –
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.
range (wx.richtext.RichTextRange) –
style (wx.richtext.RichTextAttr) –
bool
GetStyleSheet
(self)¶Returns the style sheet associated with the overall buffer.
GetText
(self)¶Get all the text.
string
GetTextForRange
(self, range)¶Returns any text in this object for the given range.
range (wx.richtext.RichTextRange) –
string
GetUncombinedStyle
(self, position, style)¶Returns the content (uncombined) attributes for this position.
position (long) –
style (wx.richtext.RichTextAttr) –
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.
pos (long) –
caretPosition (bool) –
startOfLine (bool) –
long
GetXMLNodeName
(self)¶Returns the XML
node name of this object.
This must be overridden for XmlNode-base XML
export to work.
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.
range (wx.richtext.RichTextRange) –
style (wx.richtext.RichTextAttr) –
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.
range (wx.richtext.RichTextRange) –
style (wx.richtext.RichTextAttr) –
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).
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
pt (wx.Point) –
flags (int) –
tuple
( int, textPosition, obj, contextObj )
ImportFromXML
(self, buffer, node, handler, recurse)¶Imports this object from XML
.
buffer (wx.richtext.RichTextBuffer) –
node (wx.xml.XmlNode) –
handler (wx.richtext.RichTextXMLHandler) –
recurse (bool) –
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.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
fieldType (string) –
properties (wx.richtext.RichTextProperties) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
textAttr (wx.richtext.RichTextAttr) –
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.
position (long) –
fragment (wx.richtext.RichTextParagraphLayoutBox) –
bool
InsertImageWithUndo
(self, buffer, pos, imageBlock, ctrl, flags, textAttr)¶Submits a command to insert the given image.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
imageBlock (wx.richtext.RichTextImageBlock) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
textAttr (wx.richtext.RichTextAttr) –
bool
InsertNewlineWithUndo
(self, buffer, pos, ctrl, flags=0)¶Submits a command to insert the given text.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
bool
InsertObjectWithUndo
(self, buffer, pos, object, ctrl, flags=0)¶Inserts an object.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
object (wx.richtext.RichTextObject) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
InsertParagraphsWithUndo
(self, buffer, pos, paragraphs, ctrl, flags=0)¶Submits a command to insert paragraphs.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
paragraphs (wx.richtext.RichTextParagraphLayoutBox) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
bool
InsertTextWithUndo
(self, buffer, pos, text, ctrl, flags=0)¶Submits a command to insert the given text.
buffer (wx.richtext.RichTextBuffer) –
pos (long) –
text (string) –
ctrl (wx.richtext.RichTextCtrl) –
flags (int) –
bool
Invalidate
(self, invalidRange=RICHTEXT_ALL)¶Invalidates the buffer.
With no argument, invalidates whole buffer.
invalidRange (wx.richtext.RichTextRange) –
InvalidateHierarchy
(self, invalidRange=RICHTEXT_ALL)¶Do the (in)validation both up and down the hierarchy.
invalidRange (wx.richtext.RichTextRange) –
IsDirty
(self)¶Returns True
if this object needs layout.
bool
IsTopLevel
(self)¶Returns True
if this object is top-level, i.e. contains its own paragraphs, such as a text box.
bool
Layout
(self, dc, context, rect, parentRect, style)¶Lay the item out at the specified position with the given size constraint.
Layout must set the cached size. rect is the available space for the object, and parentRect is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box).
dc (wx.DC) –
context (wx.richtext.RichTextDrawingContext) –
rect (wx.Rect) –
parentRect (wx.Rect) –
style (int) –
bool
MoveAnchoredObjectToParagraph
(self, from_, to_, obj)¶Moves an anchored object to another paragraph.
from_ (wx.richtext.RichTextParagraph) –
to_ (wx.richtext.RichTextParagraph) –
obj (wx.richtext.RichTextObject) –
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.
See also
SetListStyle
, PromoteList
, ClearListStyle
NumberList (self, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)
range (wx.richtext.RichTextRange) –
flags (int) –
startFrom (int) –
specifiedLevel (int) –
bool
NumberList (self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)
range (wx.richtext.RichTextRange) –
defName (string) –
flags (int) –
startFrom (int) –
specifiedLevel (int) –
bool
PositionToXY
(self, pos, x, y)¶Converts a zero-based position to line column and paragraph number.
pos (long) –
x (long) –
y (long) –
bool
PrepareContent
(self, container)¶Prepares the content just before insertion (or after buffer reset).
Currently is only called if undo mode is on.
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.
See also
SetListStyle
, SetListStyle
, ClearListStyle
PromoteList (self, promoteBy, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)
promoteBy (int) –
range (wx.richtext.RichTextRange) –
flags (int) –
specifiedLevel (int) –
bool
PromoteList (self, promoteBy, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)
promoteBy (int) –
range (wx.richtext.RichTextRange) –
defName (string) –
flags (int) –
specifiedLevel (int) –
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).
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.
style (wx.richtext.RichTextAttr) –
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.
See also
NumberList
, PromoteList
, ClearListStyle
.
SetListStyle (self, range, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)
range (wx.richtext.RichTextRange) –
styleDef (wx.richtext.RichTextListStyleDefinition) –
flags (int) –
startFrom (int) –
specifiedLevel (int) –
bool
SetListStyle (self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)
range (wx.richtext.RichTextRange) –
defName (string) –
flags (int) –
startFrom (int) –
specifiedLevel (int) –
bool
SetObjectPropertiesWithUndo
(self, obj, properties, objToSet=None)¶Sets with undo the properties for the given object.
obj (wx.richtext.RichTextObject) –
properties (wx.richtext.RichTextProperties) –
objToSet (wx.richtext.RichTextObject) –
bool
SetPartialParagraph
(self, partialPara)¶Sets a flag indicating whether the last paragraph is partial or complete.
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.
range (wx.richtext.RichTextRange) –
properties (wx.richtext.RichTextProperties) –
flags (int) –
bool
SetRichTextCtrl
(self, ctrl)¶Associates a control with the buffer, for operations that for example require refreshing the window.
ctrl (wx.richtext.RichTextCtrl) –
SetStyle
(self, *args, **kw)¶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.
range (wx.richtext.RichTextRange) –
style (wx.richtext.RichTextAttr) –
flags (int) –
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.
obj (wx.richtext.RichTextObject) –
textAttr (wx.richtext.RichTextAttr) –
flags (int) –
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.
availableRect (wx.Rect) –
untilObj (wx.richtext.RichTextObject) –
bool
UpdateRanges
(self)¶Calculate ranges.
XYToPosition
(self, x, y)¶Converts zero-based line column and paragraph number to a position.
x (long) –
y (long) –
long
BasicStyle
¶See GetBasicStyle
and SetBasicStyle
DefaultStyle
¶See GetDefaultStyle
and SetDefaultStyle
FloatCollector
¶FloatingObjectCount
¶InvalidRange
¶See GetInvalidRange
LineCount
¶See GetLineCount
ParagraphCount
¶PartialParagraph
¶RichTextCtrl
¶See GetRichTextCtrl
and SetRichTextCtrl
StyleSheet
¶See GetStyleSheet
XMLNodeName
¶See GetXMLNodeName