RichTextCtrl provides a generic, ground-up implementation of a text control
capable of showing multiple styles and images. It inherits from
TextCtrl and so supports all methods and event handlers
available in that class.
RichTextCtrl also sends notification events specific to the rich text
class: see RichTextEvent. It also sends the
standard TextCtrl events EVT_COMMAND_TEXT_ENTER and
EVT_COMMAND_TEXT_UPDATED, and TextUrlEvent when URL
content is clicked.
Constructors.
Adds an image to the control’s buffer.
Adds a new paragraph of text to the end of the buffer.
Sets the insertion point to the end of the buffer and writes the text.
Applies the given alignment to the selection (undoable).
For alignment values, see RichTextAttr.
Apples bold to the selection (undoable).
Applies italic to the selection (undoable).
Applies the given style to the selection.
Applies the style sheet to the buffer, matching paragraph styles in the sheet against named styles
in the buffer. This might be useful if the styles have changed. If sheet is NULL, the
sheet set with SetStyleSheet is used.
Currently this applies paragraph styles only.
Applies underline to the selection (undoable).
Returns if undo commands are being batched.
Begins using alignment
For alignment values, see RichTextAttr.
Starts batching undo history for commands.
Begins using bold.
Begins using the named character style.
Begins using this font.
Begins using the given point size.
Begins using italic.
Begins applying a left indent and subindent 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.
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.
Begins appling line spacing. spacing is a multiple, where 10 means single-spacing,
15 means 1.5 spacing, and 20 means double spacing. The following constants are
defined for convenience:
Begins using a specified list style. Optionally, you can also pass a level and a number.
Begins a 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:
#define TEXT_ATTR_BULLET_STYLE_NONE 0×00000000 #define TEXT_ATTR_BULLET_STYLE_ARABIC 0×00000001 #define TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0×00000002 #define TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0×00000004 #define TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0×00000008 #define TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0×00000010 #define TEXT_ATTR_BULLET_STYLE_SYMBOL 0×00000020 #define TEXT_ATTR_BULLET_STYLE_BITMAP 0×00000040 #define TEXT_ATTR_BULLET_STYLE_PARENTHESES 0×00000080 #define TEXT_ATTR_BULLET_STYLE_PERIOD 0×00000100 #define TEXT_ATTR_BULLET_STYLE_STANDARD 0×00000200 #define TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0×00000400 #define TEXT_ATTR_BULLET_STYLE_OUTLINE 0×00000800 #define TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0×00000000 #define TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0×00001000 #define TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0×00002000RichTextBuffer 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.
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
a millimetre.
Begins applying the named paragraph style.
Begins a right indent, specified in tenths of a millimetre.
Begins applying a style.
Starts suppressing undo history for commands.
Begins applying a symbol bullet, using a character from the current font. See begin_numbered_bullet for
an explanation of how indentation is used to render the bulleted paragraph.
Begins using this colour.
Begins using underlining.
Begins applying 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.
Returns if selected content can be copied to the clipboard.
Returns if selected content can be copied to the clipboard and deleted.
Returns if selected content can be deleted.
Returns if the clipboard content can be pasted to the buffer.
Returns if there is a command in the command history that can be redone.
Returns if there is a command in the command history that can be undone.
Clears the buffer content, leaving a single empty paragraph. Cannot be undone.
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:
See also set_list_style, promote_list, number_list.
Sends the event to the control.
Copies the selected content (if any) to the clipboard.
Creates the underlying window.
Copies the selected content (if any) to the clipboard and deletes the selection.
This is undoable.
Deletes the content within the given range.
Deletes content if there is a selection, e.g. when pressing a key.
Returns the new caret position in newPos, or leaves it if there
was no action. This is undoable.
Deletes the content in the selection, if any. This is undoable.
Sets the buffer’s modified status to , and clears the buffer’s command history.
Currently this simply returns Size(10, 10)
.
Ends alignment.
Ends application of all styles in the current style stack.
Ends batching undo command history.
Ends using bold.
Ends application of a named character style.
Ends using a font.
Ends using a point size.
Ends using italic.
Ends left indent.
Ends line spacing.
Ends using a specified list style.
Ends application of a numbered bullet.
Ends paragraph spacing.
Ends application of a named character style.
Ends right indent.
Ends the current style.
Ends suppressing undo command history.
Ends applying a symbol bullet.
Ends applying a text colour.
End applying underlining.
Ends applying a URL.
Helper function for extending the selection, returning if the selection was
changed. Selections are in caret positions.
Helper function for finding the caret position for the next word. Direction
is 1 (forward) or -1 (backwards).
Call this function to prevent refresh and allow fast updates, and then Thaw to
refresh the control.
Gets 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).
Returns the buffer associated with the control.
Returns the current caret position.
Returns the caret height and position for the given character position.
Gets the command processor associated with the control’s buffer.
Gets the size of the buffer beyond which layout is delayed during resizing.
This optimizes sizing for large buffers. The default is 20000.
Gets the current filename associated with the control.
Returns the first visible position in the current view.
Returns flags that change the behaviour of loading or saving. See the documentation for each
handler class to see what flags are relevant for each handler.
Returns the current insertion point.
Returns the last position in the buffer.
Returns the length of the specified line in characters.
Returns the text for the given line.
Transforms physical window position to logical (unscrolled) position.
Returns the number of lines in the buffer.
Transforms logical (unscrolled) position to physical window position.
Gets the text for the given range.
The end point of range is specified as the last character position of the span of text, plus one.
Returns the range of the current selection.
The end point of range is specified as the last character position of the span of text, plus one.
If the return values from and to are the same, there is no selection.
Returns the selection range in character positions. -1, -1 means no selection.
Returns the text within the current selection range, if any.
Gets the attributes at the given position. This function gets the
combined style – that is, the style you see on the screen as a result of
combining base style, paragraph style and character style attributes. To
get the character or paragraph style alone, use
get_uncombined_style.
Gets the attributes common to the specified range. Attributes that
differ in value within the range will not be included in _style_’s
flags.
Returns the style sheet associated with the control, if any. A style
sheet allows named character and paragraph styles to be applied.
Gets the attributes at the given 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 get_style.
Returns the content of the entire control as a string.
Internal helper function returning the line for the visible caret position. If the caret is
shown at the very end of the line, it means the next character is actually
on the following line. So this function gets the line we’re expecting to find
if this is the case.
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.
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.
Returns if there is a selection.
Finds the character at the given position in pixels.
pt is in device coords (not adjusted for the client area origin nor for scrolling).
Initialises the members of the control.
Initialises the command event.
Returns if the user has recently set the default style without moving
the caret, and therefore the UI needs to reflect the default style and
not the style at the caret.
See also set_and_show_default_style.
Returns if the control is editable.
Returns if Freeze has been called without a Thaw.
Returns if the buffer has been modified.
Returns if the control is multiline.
Returns if the given position is visible on the screen.
Returns if all of the selection is aligned according to the specified flag.
Returns if all of the selection is bold.
Returns if all of the selection is italic.
Returns if all of the selection is underlined.
Returns if the control is single-line. Currently RichTextCtrl does not
support single-line editing.
Helper function implementing keyboard navigation.
Lays out the buffer, which must be done before certain operations, such as
setting the caret position. This function should not normally be required by the
application.
Inserts a line break at the current insertion point. A line break forces wrapping within a paragraph, and
can be introduced by using this function, by appending the Char value RichTextLineBreakChar to text content,
or by typing Shift-Return.
Loads content into the control’s buffer using the given type. If the specified type
is RICHTEXT_TYPE_ANY, the type is deduced from the filename extension.
This function looks for a suitable RichTextFileHandler object.
Marks the buffer as modified.
Move the caret to the given character position.
Move the caret one visual step forward: this may mean setting a flag
and keeping the same position if we’re going from the end of one line
to the start of the next, which may be the exact same caret position.
Move the caret one visual step forward: this may mean setting a flag
and keeping the same position if we’re going from the end of one line
to the start of the next, which may be the exact same caret position.
Moves the caret down.
Moves to the end of the buffer.
Moves to the start of the buffer.
Moves left.
Moves right.
Moves to the end of the line.
Moves to the start of the line.
Moves to the end of the paragraph.
Moves to the start of the paragraph.
Moves up.
Inserts a new paragraph at the current insertion point. See also line_break.
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:
See also set_list_style, promote_list, clear_list_style.
Standard handler for the ID_CLEAR command.
Shows a standard context menu with undo, redo, cut, copy, paste, clear, and select all commands.
Standard handler for the ID_COPY command.
Standard handler for the ID_CUT command.
Loads the first dropped file.
Standard handler for the ID_PASTE command.
Standard handler for the ID_REDO command.
Standard handler for the ID_SELECTALL command.
Standard handler for the ID_PASTE command.
Standard update handler for the ID_CLEAR command.
Standard update handler for the ID_COPY command.
Standard update handler for the ID_CUT command.
Standard update handler for the ID_PASTE command.
Standard update handler for the ID_REDO command.
Standard update handler for the ID_SELECTALL command.
Standard update handler for the ID_UNDO command.
Moves one or more pages down.
Moves one or more pages up.
Paints the background.
Pastes content from the clipboard to the buffer.
Internal function to position the visible caret according to the current caret position.
Converts a text position to zero-based column and line numbers.
Promotes or demotes the paragraphs in 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:
See also set_list_style, See also set_list_style, clear_list_style.
Redoes the current command.
Removes the content in the specified range.
Replaces the content in the specified range with the string specified by value.
Saves the buffer content using the given type. If the specified type
is RICHTEXT_TYPE_ANY, the type is deduced from the filename
extension.
In order to use this method, a
RichTextFileHandler object must have been set previously.
Scrolls position into view. This function takes a caret position.
Selects all the text in the buffer.
Cancels any selection.
Sets attr as the default style and tells the control that the UI should reflect
this attribute until the user moves the caret.
See also is_default_style_showing.
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).
The caret position is the character position just before the caret.
A value of -1 means the caret is at the start of the buffer.
Sets the current default style, which can be used to change how
subsequently inserted text is displayed.
Sets the default style to the style under the cursor.
Sets the size of the buffer beyond which layout is delayed during resizing.
This optimizes sizing for large buffers. The default is 20000.
Makes the control editable, or not.
Sets the current filename.
Sets the font, and also the basic and default attributes (see set_default_style).
Sets flags that change the behaviour of loading or saving. See the documentation for each
handler class to see what flags are relevant for each handler.
Sets the insertion point.
Sets the insertion point to the end of the text control.
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:
See also number_list, promote_list, clear_list_style.
Sets the selection to the given range.
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 selection for a character at position 5, use the range (5,6).
Sets the selection to the given range.
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 selection for a character at position 5, use the range (5,6).
Sets the attributes for the given range. 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 style for a character at position 5, use the
range (5,6).
Sets the attributes for the given range, passing flags to determine how the attributes are set. The RichTextAttr version is more efficient
because it does not use Font objects.
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 style for a character at position 5, use the range (5,6).
flags may contain a bit list of the following values:
Sets the style sheet associated with the control. A style sheet allows named
character and paragraph styles to be applied.
Replaces existing content with the given text.
A helper function setting up scrollbars, for example after a resize.
Scrolls the buffer so that the given position is in view.
Returns true
if undo history suppression is on.
Call this function to end a Freeze and refresh the display.
Undoes the command at the top of the command history, if there is one.
Moves a number of words to the left.
Move a nuber of words to the right.
Loads an image from a file and writes it at the current insertion point.
Boolean write_image(%(arg-type)Bitmap% bitmap, Integer bitmapType = BITMAP_TYPE_PNG) Boolean write_image(%(arg-type)Image% image, Integer bitmapType = BITMAP_TYPE_PNG)Write a bitmap or image at the current insertion point. Supply an
optional type to use for internal and file storage of the raw data.
Writes text at the current position.
Translates from column and line number to position.
[This page automatically generated from the Textile source at 2023-06-09 00:45:32 +0000]