This is a kind of paragraph layout box, used to represent the whole buffer.
Default constructor. |
|
Adds a drawing handler to the end. |
|
Adds an event handler. |
|
Adds a field type. |
|
Adds a file handler to the end. |
|
Convenience function to add a paragraph of text. |
|
Returns |
|
Begins using alignment. |
|
Begin collapsing undo/redo commands. |
|
Begins using bold. |
|
Begins named character style. |
|
Begins using this font. |
|
Begins using point size. |
|
Begins using italic. |
|
Begins using leftIndent for the left indent, and optionally leftSubIndent for the sub-indent. |
|
Begins line spacing using the specified value. |
|
Begins named list style. |
|
Begins numbered bullet. |
|
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre. |
|
Begins named paragraph style. |
|
Begins a right indent, specified in tenths of a millimetre. |
|
Begins applying a standard bullet, using one of the standard bullet names (currently |
|
Begin using a style. |
|
Begin suppressing undo/redo commands. |
|
Begins applying a symbol bullet, using a character from the current font. |
|
Begins using this colour. |
|
Begins applying |
|
Begins using underline. |
|
Returns |
|
Clean up drawing handlers. |
|
Cleans up field types. |
|
Clean up file handlers. |
|
Clear event handlers. |
|
Clears the style stack. |
|
Clones the buffer. |
|
Copies the buffer. |
|
Copy the range to the clipboard. |
|
Submits a command to delete this range. |
|
Ends alignment. |
|
End all styles. |
|
End collapsing undo/redo commands. |
|
Ends using bold. |
|
Ends named character style. |
|
Ends using a font. |
|
Ends using point size. |
|
Ends using italic. |
|
Ends left indent. |
|
Ends line spacing. |
|
Ends named character style. |
|
Ends numbered bullet. |
|
Ends paragraph spacing. |
|
Ends named character style. |
|
Ends right indent. |
|
Ends standard bullet. |
|
End the style. |
|
End suppressing undo/redo commands. |
|
Ends symbol bullet. |
|
Ends using a colour. |
|
Ends URL. |
|
Ends using underline. |
|
Finds a drawing handler by name. |
|
Finds a field type by name. |
|
Finds a handler by type. |
|
Finds a file handler by extension and type. |
|
Finds a file handler by name. |
|
Finds a handler by filename or, if supplied, type. |
|
Returns the collapsed command. |
|
Returns the factor to multiply by character height to get a reasonable bullet size. |
|
Returns the minimum margin between bullet and paragraph in 10ths of a mm. |
|
Returns the command processor. |
|
Returns the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing. |
|
Returns the drawing handlers. |
|
Gets a wildcard string for the file dialog based on all the currently |
|
Returns the floating layout mode. |
|
Returns the scale factor for displaying fonts, for example for more comfortable editing. |
|
Returns the table storing fonts, for quick access and font reuse. |
|
Gets the handler flags, controlling loading and saving. |
|
Returns the file handlers. |
|
Returns the renderer object. |
|
Returns the scale factor for calculating dimensions. |
|
Returns the style sheet. |
|
Returns the size of the style stack, for example to check correct nesting. |
|
Hit-testing: returns a flag indicating hit test details, plus information about position. |
|
Initialisation. |
|
Initialise the standard file handlers. |
|
Inserts a drawing handler at the front. |
|
Inserts a file handler at the front. |
|
Submits a command to insert the given image. |
|
Submits a command to insert a newline. |
|
Submits a command to insert an object. |
|
Submits a command to insert paragraphs. |
|
Submits a command to insert the given text. |
|
Returns |
|
Loads content from a stream or file. |
|
Mark modified. |
|
Paste the clipboard content to the buffer. |
|
Pops the style sheet from the top of the style sheet stack. |
|
Pushes the style sheet to the top of the style sheet stack. |
|
Removes a drawing handler. |
|
Removes an event handler from the buffer’s list of handlers, deleting the object if deleteHandler is |
|
Removes a field type by name. |
|
Removes a file handler. |
|
Clears the buffer, adds an empty paragraph, and clears the command processor. |
|
Saves content to a stream or file. |
|
Send event to event handlers. |
|
Sets the factor to multiply by character height to get a reasonable bullet size. |
|
Sets the minimum margin between bullet and paragraph in 10ths of a mm. |
|
Sets the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing. |
|
Sets the floating layout mode. |
|
Sets the scale factor for displaying fonts, for example for more comfortable editing. |
|
Sets table storing fonts, for quick access and font reuse. |
|
Sets the handler flags, controlling loading and saving. |
|
Sets renderer as the object to be used to render certain aspects of the content, such as bullets. |
|
Sets the scale factor for calculating dimensions. |
|
Sets style sheet, if any. |
|
Sets the style sheet and sends a notification of the change. |
|
Submit the action immediately, or delay according to whether collapsing is on. |
|
Are we suppressing undo?? |
See |
|
See |
|
See |
|
See |
|
See |
|
Possible constructors:
RichTextBuffer() -> None
RichTextBuffer(obj : RichTextBuffer) -> None
This is a kind of paragraph layout box, used to represent the whole buffer.
__init__ (self)
Default constructor.
None
__init__ (self, obj : RichTextBuffer)
Copy constructor.
None
Adds a drawing handler to the end.
handler (wx.richtext.RichTextDrawingHandler)
None
Adds an event handler.
A buffer associated with a control has the control as the only event handler, but the application is free to add more if further notification is required. All handlers are notified of an event originating from the buffer, such as the replacement of a style sheet during loading.
The buffer never deletes any of the event handlers, unless RemoveEventHandler
is called with True
as the second argument.
handler (wx.EvtHandler)
bool
Adds a field type.
fieldType (wx.richtext.RichTextFieldType)
None
Adds a file handler to the end.
handler (wx.richtext.RichTextFileHandler)
None
Convenience function to add a paragraph of text.
text (string)
paraStyle (wx.richtext.RichTextAttr)
Returns True
if we are collapsing commands.
bool
Begins using alignment.
alignment (TextAttrAlignment)
bool
Begin collapsing undo/redo commands.
Note that this may not work properly if combining commands that delete or insert content, changing ranges for subsequent actions.
cmdName should be the name of the combined command that will appear next to Undo and Redo in the edit menu.
cmdName (string)
bool
Begins using bold.
bool
Begins named character style.
characterStyle (string)
bool
Begins using point size.
pointSize (int)
bool
Begins using italic.
bool
Begins using leftIndent for the left indent, and optionally leftSubIndent for the sub-indent.
Both are expressed in tenths of a millimetre.
The sub-indent is an offset from the left of the paragraph, and is used for all but the first line in a paragraph. A positive value will cause the first line to appear to the left of the subsequent lines, and a negative value will cause the first line to be indented relative to the subsequent lines.
leftIndent (int)
leftSubIndent (int)
bool
Begins line spacing using the specified value.
spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means float spacing.
The wx.TextAttrLineSpacing enumeration values are defined for convenience.
lineSpacing (int)
bool
Begins named list style.
Optionally, you can also pass a level and a number.
listStyle (string)
level (int)
number (int)
bool
Begins numbered bullet.
This call will be needed for each item in the list, and the application should take care of incrementing the numbering.
bulletNumber is a number, usually starting with 1. leftIndent and leftSubIndent are values in tenths of a millimetre. bulletStyle is a bitlist of the following values:
wx.richtext.RichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between the margin and the bullet. The content of the paragraph, including the first line, starts at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the left of the actual paragraph is leftSubIndent.
bulletNumber (int)
leftIndent (int)
leftSubIndent (int)
bulletStyle (int)
bool
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.
before (int)
after (int)
bool
Begins named paragraph style.
paragraphStyle (string)
bool
Begins a right indent, specified in tenths of a millimetre.
rightIndent (int)
bool
Begins applying a standard bullet, using one of the standard bullet names (currently standard/circle
or standard/square
.
See BeginNumberedBullet
for an explanation of how indentation is used to render the bulleted paragraph.
bulletName (string)
leftIndent (int)
leftSubIndent (int)
bulletStyle (int)
bool
Begin using a style.
style (wx.richtext.RichTextAttr)
bool
Begin suppressing undo/redo commands.
The way undo is suppressed may be implemented differently by each command. If not dealt with by a command implementation, then it will be implemented automatically by not storing the command in the undo history when the action is submitted to the command processor.
bool
Begins applying a symbol bullet, using a character from the current font.
See BeginNumberedBullet
for an explanation of how indentation is used to render the bulleted paragraph.
symbol (string)
leftIndent (int)
leftSubIndent (int)
bulletStyle (int)
bool
Begins using this colour.
colour (wx.Colour)
bool
Begins applying wx.TEXT_ATTR_URL
to the content.
Pass a URL and optionally, a character style to apply, since it is common to mark a URL with a familiar style such as blue text with underlining.
url (string)
characterStyle (string)
bool
Begins using underline.
bool
Returns True
if we can paste from the clipboard.
bool
Clean up drawing handlers.
None
Cleans up field types.
None
Clean up file handlers.
None
Clear event handlers.
None
Clears the style stack.
None
Clones the buffer.
Copies the buffer.
None
Copy the range to the clipboard.
range (wx.richtext.RichTextRange)
bool
Submits a command to delete this range.
range (wx.richtext.RichTextRange)
ctrl (wx.richtext.RichTextCtrl)
bool
Ends alignment.
bool
End all styles.
bool
End collapsing undo/redo commands.
bool
Ends using bold.
bool
Ends named character style.
bool
Ends using a font.
bool
Ends using point size.
bool
Ends using italic.
bool
Ends left indent.
bool
Ends line spacing.
bool
Ends named character style.
bool
Ends numbered bullet.
bool
Ends paragraph spacing.
bool
Ends named character style.
bool
Ends right indent.
bool
Ends standard bullet.
bool
End the style.
bool
End suppressing undo/redo commands.
bool
Ends symbol bullet.
bool
Ends using a colour.
bool
Ends URL.
bool
Ends using underline.
bool
Finds a drawing handler by name.
name (string)
Finds a field type by name.
name (string)
Finds a handler by type.
imageType (RichTextFileType)
Finds a file handler by extension and type.
extension (string)
imageType (RichTextFileType)
Finds a file handler by name.
name (string)
Finds a handler by filename or, if supplied, type.
filename (string)
imageType (RichTextFileType)
Returns the collapsed command.
Returns the factor to multiply by character height to get a reasonable bullet size.
float
Returns the minimum margin between bullet and paragraph in 10ths of a mm.
int
Returns the command processor.
A text buffer always creates its own command processor when it is initialized.
Returns the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.
float
Returns the drawing handlers.
RichTextDrawingHandlerList
Gets a wildcard string for the file dialog based on all the currently loaded richtext file handlers, and a list that can be used to map those filter types to the file handler type.
Any
Returns the floating layout mode.
The default is True
, where objects are laid out according to their floating status.
bool
Returns the scale factor for displaying fonts, for example for more comfortable editing.
float
Returns the table storing fonts, for quick access and font reuse.
Gets the handler flags, controlling loading and saving.
int
Returns the file handlers.
RichTextFileHandlerList
Returns the renderer object.
Returns the scale factor for calculating dimensions.
float
Returns the style sheet.
Returns the size of the style stack, for example to check correct nesting.
int
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, int, RichTextObject, RichTextObject]
One of the wx.richtext.RichTextHitTestFlags values.
Initialisation.
None
Initialise the standard file handlers.
Currently, only the plain text loading/saving handler is initialised by default.
None
Inserts a drawing handler at the front.
handler (wx.richtext.RichTextDrawingHandler)
None
Inserts a file handler at the front.
handler (wx.richtext.RichTextFileHandler)
None
Submits a command to insert the given image.
pos (long)
imageBlock (wx.richtext.RichTextImageBlock)
ctrl (wx.richtext.RichTextCtrl)
flags (int)
textAttr (wx.richtext.RichTextAttr)
bool
Submits a command to insert a newline.
pos (long)
ctrl (wx.richtext.RichTextCtrl)
flags (int)
bool
Submits a command to insert an object.
pos (long)
object (wx.richtext.RichTextObject)
ctrl (wx.richtext.RichTextCtrl)
flags (int)
Submits a command to insert paragraphs.
pos (long)
paragraphs (wx.richtext.RichTextParagraphLayoutBox)
ctrl (wx.richtext.RichTextCtrl)
flags (int)
bool
Submits a command to insert the given text.
pos (long)
text (string)
ctrl (wx.richtext.RichTextCtrl)
flags (int)
bool
Returns True
if the buffer was modified.
bool
LoadFile (self, filename : str, type: RichTextFileType=RICHTEXT_TYPE_ANY)
Loads content from a stream or file.
Not all handlers will implement file loading.
filename (string)
type (RichTextFileType)
bool
LoadFile (self, stream : InputStream, type: RichTextFileType=RICHTEXT_TYPE_ANY)
stream (wx.InputStream)
type (RichTextFileType)
bool
Mark modified.
modify (bool)
None
Paste the clipboard content to the buffer.
position (long)
bool
Pops the style sheet from the top of the style sheet stack.
Pushes the style sheet to the top of the style sheet stack.
styleSheet (wx.richtext.RichTextStyleSheet)
bool
Removes a drawing handler.
name (string)
bool
Removes an event handler from the buffer’s list of handlers, deleting the object if deleteHandler is True
.
handler (wx.EvtHandler)
deleteHandler (bool)
bool
Removes a field type by name.
name (string)
bool
Removes a file handler.
name (string)
bool
Clears the buffer, adds an empty paragraph, and clears the command processor.
None
SaveFile (self, filename : str, type: RichTextFileType=RICHTEXT_TYPE_ANY)
Saves content to a stream or file.
Not all handlers will implement file saving.
filename (string)
type (RichTextFileType)
bool
SaveFile (self, stream : OutputStream, type: RichTextFileType=RICHTEXT_TYPE_ANY)
stream (wx.OutputStream)
type (RichTextFileType)
bool
Send event to event handlers.
If sendToAll is True
, will send to all event handlers, otherwise will stop at the first successful one.
event (wx.Event)
sendToAll (bool)
bool
Sets the factor to multiply by character height to get a reasonable bullet size.
prop (float)
None
Sets the minimum margin between bullet and paragraph in 10ths of a mm.
margin (int)
None
Sets the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.
This can be useful when editing in a small control where you still want legible text, but a minimum of wasted white space.
dimScale (float)
None
Sets the floating layout mode.
Pass False
to speed up editing by not performing floating layout. This setting affects all buffers.
mode (bool)
None
Sets the scale factor for displaying fonts, for example for more comfortable editing.
fontScale (float)
None
Sets table storing fonts, for quick access and font reuse.
table (wx.richtext.RichTextFontTable)
None
Sets the handler flags, controlling loading and saving.
flags (int)
None
Sets renderer as the object to be used to render certain aspects of the content, such as bullets.
You can override default rendering by deriving a new class from wx.richtext.RichTextRenderer or wx.richtext.RichTextStdRenderer, overriding one or more virtual functions, and setting an instance of the class using this function.
renderer (wx.richtext.RichTextRenderer)
None
Sets the scale factor for calculating dimensions.
scale (float)
None
Sets style sheet, if any.
This will allow the application to use named character and paragraph styles found in the style sheet.
Neither the buffer nor the control owns the style sheet so must be deleted by the application.
styleSheet (wx.richtext.RichTextStyleSheet)
None
Sets the style sheet and sends a notification of the change.
sheet (wx.richtext.RichTextStyleSheet)
bool
Submit the action immediately, or delay according to whether collapsing is on.
action (wx.richtext.RichTextAction)
bool
Are we suppressing undo??
bool
See GetDimensionScale
and SetDimensionScale
See GetFontScale
and SetFontScale
See GetFontTable
and SetFontTable
See GetHandlerFlags
and SetHandlerFlags
See GetStyleSheet
and SetStyleSheet