+ Returns the buffer associated with the control.
+ */
+ wxRichTextBuffer& GetBuffer() { return m_buffer; }
+ const wxRichTextBuffer& GetBuffer() const { return m_buffer; }
+ //@}
+
+ /**
+ Starts batching undo history for commands.
+ */
+ virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); }
+
+ /**
+ Ends batching undo command history.
+ */
+ virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); }
+
+ /**
+ Returns @true if undo commands are being batched.
+ */
+ virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); }
+
+ /**
+ Starts suppressing undo history for commands.
+ */
+ virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); }
+
+ /**
+ Ends suppressing undo command history.
+ */
+ virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); }
+
+ /**
+ Returns @true if undo history suppression is on.
+ */
+ virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); }
+
+ /**
+ 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.
+ @a style must have flags indicating which attributes are of interest.
+ */
+ virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
+ {
+ return GetBuffer().HasCharacterAttributes(range.ToInternal(), 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.
+ @a style must have flags indicating which attributes are of interest.
+ */
+ virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
+ {
+ return GetBuffer().HasParagraphAttributes(range.ToInternal(), style);
+ }
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is bold.
+ */
+ virtual bool IsSelectionBold();
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is italic.
+ */
+ virtual bool IsSelectionItalics();
+
+ /**
+ Returns @true if all of the selection, or the content at the caret position, is underlined.
+ */
+ virtual bool IsSelectionUnderlined();
+
+ /**
+ Returns @true if all of the selection, or the content at the current caret position, has the supplied wxTextAttrEffects flag(s).
+ */
+ virtual bool DoesSelectionHaveTextEffectFlag(int flag);
+
+ /**
+ Returns @true if all of the selection is aligned according to the specified flag.
+ */
+ virtual bool IsSelectionAligned(wxTextAttrAlignment alignment);
+
+ /**
+ Apples bold to the selection or the default style (undoable).
+ */
+ virtual bool ApplyBoldToSelection();
+
+ /**
+ Applies italic to the selection or the default style (undoable).
+ */
+ virtual bool ApplyItalicToSelection();
+
+ /**
+ Applies underline to the selection or the default style (undoable).
+ */
+ virtual bool ApplyUnderlineToSelection();
+
+ /**
+ Applies one or more wxTextAttrEffects flags to the selection (undoable).
+ If there is no selection, it is applied to the default style.
+ */
+ virtual bool ApplyTextEffectToSelection(int flags);
+
+ /**
+ Applies the given alignment to the selection or the default style (undoable).
+ For alignment values, see wxTextAttr.
+ */
+ virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment);
+
+ /**
+ 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 @a sheet is @NULL, the sheet set with SetStyleSheet() is used.
+ Currently this applies paragraph styles only.
+ */
+ virtual bool ApplyStyle(wxRichTextStyleDefinition* def);
+
+ /**
+ Sets the style sheet associated with the control.
+ A style sheet allows named character and paragraph styles to be applied.
+ */
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); }
+
+ /**
+ Returns the style sheet associated with the control, if any.
+ A style sheet allows named character and paragraph styles to be applied.
+ */
+ wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); }
+
+ /**
+ Push the style sheet to top of stack.
+ */
+ bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); }
+
+ /**
+ Pops the style sheet from top of stack.
+ */
+ wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); }
+
+ /**
+ Applies the style sheet to the buffer, for example if the styles have changed.
+ */
+ bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL);
+
+ /**
+ Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy.
+ */
+ virtual bool ShowContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands);
+
+ /**
+ Prepares the context menu, optionally adding appropriate property-editing commands.
+ Returns the number of property commands added.
+ */
+ virtual int PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands);
+
+ /**
+ Returns @true if we can edit the object's properties via a GUI.
+ */
+ virtual bool CanEditProperties(wxRichTextObject* obj) const;
+
+ /**
+ Edits the object's properties via a GUI.
+ */
+ virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent);
+
+ /**
+ Gets the object's properties menu label.
+ */
+ virtual wxString GetPropertiesMenuLabel(wxRichTextObject* obj);
+
+ /**
+ Prepares the content just before insertion (or after buffer reset). Called by the same function in wxRichTextBuffer.
+ Currently is only called if undo mode is on.
+ */
+ virtual void PrepareContent(wxRichTextParagraphLayoutBox& WXUNUSED(container)) {}
+
+ /**
+ Can we delete this range?
+ Sends an event to the control.
+ */
+ virtual bool CanDeleteRange(wxRichTextParagraphLayoutBox& container, const wxRichTextRange& range) const;
+
+ /**
+ Can we insert content at this position?
+ Sends an event to the control.
+ */
+ virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const;
+
+ /**
+ Enable or disable the vertical scrollbar.
+ */
+ virtual void EnableVerticalScrollbar(bool enable);
+
+ /**
+ Returns @true if the vertical scrollbar is enabled.
+ */
+ virtual bool GetVerticalScrollbarEnabled() const;
+
+// Command handlers
+
+ /**
+ Sends the event to the control.
+ */
+ void Command(wxCommandEvent& event);
+
+ /**
+ Loads the first dropped file.
+ */
+ void OnDropFiles(wxDropFilesEvent& event);
+
+ void OnCaptureLost(wxMouseCaptureLostEvent& event);
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+ /**
+ Standard handler for the wxID_CUT command.
+ */
+ void OnCut(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_COPY command.
+ */
+ void OnCopy(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_PASTE command.
+ */
+ void OnPaste(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_UNDO command.
+ */
+ void OnUndo(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_REDO command.
+ */
+ void OnRedo(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_SELECTALL command.
+ */
+ void OnSelectAll(wxCommandEvent& event);
+
+ /**
+ Standard handler for property commands.
+ */
+ void OnProperties(wxCommandEvent& event);
+
+ /**
+ Standard handler for the wxID_CLEAR command.
+ */
+ void OnClear(wxCommandEvent& event);
+
+ /**
+ Standard update handler for the wxID_CUT command.
+ */
+ void OnUpdateCut(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_COPY command.
+ */
+ void OnUpdateCopy(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_PASTE command.
+ */
+ void OnUpdatePaste(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_UNDO command.
+ */
+ void OnUpdateUndo(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_REDO command.
+ */
+ void OnUpdateRedo(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_SELECTALL command.
+ */
+ void OnUpdateSelectAll(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for property commands.
+ */
+
+ void OnUpdateProperties(wxUpdateUIEvent& event);
+
+ /**
+ Standard update handler for the wxID_CLEAR command.
+ */
+ void OnUpdateClear(wxUpdateUIEvent& event);
+
+ /**
+ Shows a standard context menu with undo, redo, cut, copy, paste, clear, and
+ select all commands.
+ */
+ void OnContextMenu(wxContextMenuEvent& event);
+
+// Event handlers
+
+ // Painting
+ void OnPaint(wxPaintEvent& event);
+ void OnEraseBackground(wxEraseEvent& event);
+
+ // Left-click
+ void OnLeftClick(wxMouseEvent& event);
+
+ // Left-up
+ void OnLeftUp(wxMouseEvent& event);
+
+ // Motion
+ void OnMoveMouse(wxMouseEvent& event);
+
+ // Left-double-click
+ void OnLeftDClick(wxMouseEvent& event);
+
+ // Middle-click
+ void OnMiddleClick(wxMouseEvent& event);
+
+ // Right-click
+ void OnRightClick(wxMouseEvent& event);
+
+ // Key press
+ void OnChar(wxKeyEvent& event);
+
+ // Sizing
+ void OnSize(wxSizeEvent& event);
+
+ // Setting/losing focus
+ void OnSetFocus(wxFocusEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+
+ // Idle-time processing
+ void OnIdle(wxIdleEvent& event);
+
+ // Scrolling
+ void OnScroll(wxScrollWinEvent& event);
+
+ /**
+ Sets the font, and also the basic and default attributes
+ (see wxRichTextCtrl::SetDefaultStyle).
+ */
+ virtual bool SetFont(const wxFont& font);
+
+ /**
+ A helper function setting up scrollbars, for example after a resize.
+ */
+ virtual void SetupScrollbars(bool atTop = false);
+
+ /**
+ Helper function implementing keyboard navigation.
+ */
+ virtual bool KeyboardNavigate(int keyCode, int flags);
+
+ /**
+ Paints the background.
+ */
+ virtual void PaintBackground(wxDC& dc);
+
+ /**
+ Other user defined painting after everything else (i.e. all text) is painted.
+
+ @since 2.9.1
+ */
+ virtual void PaintAboveContent(wxDC& WXUNUSED(dc)) {}
+
+#if wxRICHTEXT_BUFFERED_PAINTING
+ /**
+ Recreates the buffer bitmap if necessary.
+ */
+ virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize);
+#endif
+
+ // Write text
+ virtual void DoWriteText(const wxString& value, int flags = 0);
+
+ // Should we inherit colours?
+ virtual bool ShouldInheritColours() const { return false; }