+ Replaces the content in the specified range with the string specified by
+ @a value.
+ */
+ virtual void Replace(long from, long to, const wxString& value);
+
+ /**
+ Removes the content in the specified range.
+ */
+ virtual void Remove(long from, long to);
+
+#ifdef DOXYGEN
+ /**
+ Loads content into the control's buffer using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ bool LoadFile(const wxString& file,
+ int type = wxRICHTEXT_TYPE_ANY);
+#endif
+
+ /**
+ Helper function for LoadFile(). Loads content into the control's buffer using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+
+#ifdef DOXYGEN
+ /**
+ Saves the buffer content using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ bool SaveFile(const wxString& file = wxEmptyString,
+ int type = wxRICHTEXT_TYPE_ANY);
+#endif
+
+ /**
+ Helper function for SaveFile(). Saves the buffer content using the given type.
+
+ If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
+ the filename extension.
+
+ This function looks for a suitable wxRichTextFileHandler object.
+ */
+ virtual bool DoSaveFile(const wxString& file = wxEmptyString,
+ int fileType = wxRICHTEXT_TYPE_ANY);
+
+ /**
+ 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.
+ */
+ void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); }
+
+ /**
+ 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.
+ */
+ int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); }
+
+ /**
+ Marks the buffer as modified.
+ */
+ virtual void MarkDirty();
+
+ /**
+ Sets the buffer's modified status to @false, and clears the buffer's command
+ history.
+ */
+ virtual void DiscardEdits();
+
+ /**
+ Sets the maximum number of characters that may be entered in a single line
+ text control. For compatibility only; currently does nothing.
+ */
+ virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
+
+ /**
+ Writes text at the current position.
+ */
+ virtual void WriteText(const wxString& text);
+
+ /**
+ Sets the insertion point to the end of the buffer and writes the text.
+ */
+ virtual void AppendText(const wxString& text);
+
+ //@{
+ /**
+ 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 GetUncombinedStyle().
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetStyle(@a position)
+ returning a 2-element list (ok, attr).
+ @endWxPerlOnly
+ */
+ virtual bool GetStyle(long position, wxTextAttr& style);
+ virtual bool GetStyle(long position, wxRichTextAttr& style);
+ virtual bool GetStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
+ //@}
+
+ //@{
+ /**
+ 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).
+ */
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+ virtual bool SetStyle(long start, long end, const wxRichTextAttr& style);
+ virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style);
+ virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style);
+ //@}
+
+ /**
+ Sets the attributes for a single object
+ */
+ virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ Gets the attributes common to the specified range.
+ Attributes that differ in value within the range will not be included
+ in @a style flags.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetStyleForRange(@a position)
+ returning a 2-element list (ok, attr).
+ @endWxPerlOnly
+ */
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style);
+ virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
+ //@}
+
+ /**
+ Sets the attributes for the given range, passing 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, plus one. So, for example, to set the style for a character at
+ position 5, use the range (5,6).
+
+ @a flags may contain a bit list of the following values:
+ - wxRICHTEXT_SETSTYLE_NONE: no style flag.
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be
+ undoable.
+ - wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied
+ if the combined style at this point is already the style in question.
+ - wxRICHTEXT_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.
+ - wxRICHTEXT_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.
+ - wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying
+ the new style.
+ - wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style. Only the style flags
+ are used in this operation.
+ */
+ virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ Gets the attributes at the given position.
+ This function gets the @e 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 @e style's flags, this function
+ will fetch the paragraph attributes.
+ Otherwise, it will return the character attributes.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as GetUncombinedStyle(@a position)
+ returning a 2-element list (ok, attr).
+ @endWxPerlOnly
+ */
+ virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
+ virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
+ //@}
+
+ //@{
+ /**
+ Sets the current default style, which can be used to change how subsequently
+ inserted text is displayed.
+ */
+ virtual bool SetDefaultStyle(const wxTextAttr& style);
+ virtual bool SetDefaultStyle(const wxRichTextAttr& style);
+ //@}
+
+ /**
+ Returns the current default style, which can be used to change how subsequently
+ inserted text is displayed.
+ */
+ virtual const wxRichTextAttr& GetDefaultStyleEx() const;
+
+ //virtual const wxTextAttr& GetDefaultStyle() const;
+
+ //@{
+ /**
+ 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.
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see NumberList(), PromoteList(), ClearListStyle().
+ */
+ virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ //@}
+
+ /**
+ Clears the list style from the given range, clearing list-related attributes
+ and applying any named paragraph style associated with each paragraph.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+
+ @see SetListStyle(), PromoteList(), NumberList().
+ */
+ virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ //@{
+ /**
+ 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.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see SetListStyle(), PromoteList(), ClearListStyle().
+ */
+ virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
+ //@}
+
+ //@{
+ /**
+ Promotes or demotes the paragraphs in the given range.
+ A positive @a 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.
+
+ @a flags is a bit list of the following:
+ - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
+ - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
+ @a startFrom, otherwise existing attributes are used.
+ - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
+ as the level for all paragraphs, otherwise the current indentation will be used.
+
+ @see SetListStyle(), @see SetListStyle(), ClearListStyle().
+ */
+ virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
+ virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
+ //@}
+
+ /**
+ 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).
+
+ @a flags may contain a bit list of the following values:
+ - wxRICHTEXT_SETSPROPERTIES_NONE: no flag.
+ - wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be
+ undoable.
+ - wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be
+ applied to paragraphs, and not the content.
+ - wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be
+ applied to characters, and not the paragraph.
+ - wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying
+ the new properties.
+ - wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties.
+ */
+ virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO);
+
+ /**
+ Deletes the content within the given range.
+ */
+ virtual bool Delete(const wxRichTextRange& range);
+
+ /**
+ Translates from column and line number to position.
+ */
+ virtual long XYToPosition(long x, long y) const;
+
+ /**
+ Converts a text position to zero-based column and line numbers.
+ */
+ virtual bool PositionToXY(long pos, long *x, long *y) const;
+
+ /**
+ Scrolls the buffer so that the given position is in view.
+ */
+ virtual void ShowPosition(long pos);
+
+ //@{
+ /**
+ Finds the character at the given position in pixels.
+ @a pt is in device coords (not adjusted for the client area origin nor for
+ scrolling).
+ */
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const;
+
+ /**
+ Finds the container at the given point, which is assumed to be in client coordinates.
+ */
+ wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0);
+ //@}
+
+// Clipboard operations
+
+ /**
+ Copies the selected content (if any) to the clipboard.
+ */
+ virtual void Copy();
+
+ /**
+ Copies the selected content (if any) to the clipboard and deletes the selection.
+ This is undoable.
+ */
+ virtual void Cut();
+
+ /**
+ Pastes content from the clipboard to the buffer.
+ */
+ virtual void Paste();
+
+ /**
+ Deletes the content in the selection, if any. This is undoable.
+ */
+ virtual void DeleteSelection();
+
+ /**
+ Returns @true if selected content can be copied to the clipboard.
+ */
+ virtual bool CanCopy() const;
+
+ /**
+ Returns @true if selected content can be copied to the clipboard and deleted.
+ */
+ virtual bool CanCut() const;
+
+ /**
+ Returns @true if the clipboard content can be pasted to the buffer.
+ */
+ virtual bool CanPaste() const;