+ /**
+ 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; }
+
+ /**
+ Internal function to position the visible caret according to the current caret
+ position.
+ */
+ virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL);
+
+ /**
+ Helper function for extending the selection, returning @true if the selection
+ was changed. Selections are in caret positions.
+ */
+ virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);
+
+ /**
+ Scrolls @a position into view. This function takes a caret position.
+ */
+ virtual bool ScrollIntoView(long position, int keyCode);
+
+ /**
+ Refreshes the area affected by a selection change.
+ */
+ bool RefreshForSelectionChange(const wxRichTextSelection& oldSelection, const wxRichTextSelection& newSelection);
+
+ /**
+ Sets the caret position.
+
+ 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.
+ Please note that this does not update the current editing style
+ from the new position or cause the actual caret to be refreshed; to do that,
+ call wxRichTextCtrl::SetInsertionPoint instead.
+ */
+ void SetCaretPosition(long position, bool showAtLineStart = false) ;
+
+ /**
+ Returns the current caret position.
+ */
+ long GetCaretPosition() const { return m_caretPosition; }
+
+ /**
+ The adjusted caret position is the character position adjusted to take
+ into account whether we're at the start of a paragraph, in which case
+ style information should be taken from the next position, not current one.
+ */
+ long GetAdjustedCaretPosition(long caretPos) const;
+
+ /**
+ 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.
+ */
+ void MoveCaretForward(long oldPosition) ;
+
+ /**
+ 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.
+ */
+ void MoveCaretBack(long oldPosition) ;
+
+ /**
+ Returns the caret height and position for the given character position.
+ If container is null, the current focus object will be used.
+
+ @beginWxPerlOnly
+ In wxPerl this method is implemented as
+ GetCaretPositionForIndex(@a position) returning a
+ 2-element list (ok, rect).
+ @endWxPerlOnly
+ */
+ bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL);
+
+ /**
+ 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.
+ */
+ wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;
+
+ /**
+ Gets the command processor associated with the control's buffer.
+ */
+ wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); }
+
+ /**
+ Deletes content if there is a selection, e.g. when pressing a key.
+ Returns the new caret position in @e newPos, or leaves it if there
+ was no action. This is undoable.
+
+ @beginWxPerlOnly
+ In wxPerl this method takes no arguments and returns a 2-element
+ list (ok, newPos).
+ @endWxPerlOnly
+ */
+ bool DeleteSelectedContent(long* newPos= NULL);
+
+ /**
+ Transforms logical (unscrolled) position to physical window position.
+ */
+ wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;
+
+ /**
+ Transforms physical window position to logical (unscrolled) position.
+ */
+ wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;
+
+ /**
+ Helper function for finding the caret position for the next word.
+ Direction is 1 (forward) or -1 (backwards).
+ */
+ virtual long FindNextWordPosition(int direction = 1) const;
+
+ /**
+ Returns @true if the given position is visible on the screen.
+ */
+ bool IsPositionVisible(long pos) const;
+
+ /**
+ Returns the first visible position in the current view.
+ */
+ long GetFirstVisiblePosition() const;
+
+ /**
+ Returns the caret position since the default formatting was changed. As
+ soon as this position changes, we no longer reflect the default style
+ in the UI. A value of -2 means that we should only reflect the style of the
+ content under the caret.
+ */
+ long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; }
+
+ /**
+ Set the caret position for the default style that the user is selecting.
+ */
+ void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; }
+
+ /**
+ Returns @true 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.
+
+ Below is an example of code that uses this function to determine whether the UI
+ should show that the current style is bold.
+
+ @see SetAndShowDefaultStyle().
+ */
+ bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; }
+
+ /**
+ Sets @a attr as the default style and tells the control that the UI should
+ reflect this attribute until the user moves the caret.
+
+ @see IsDefaultStyleShowing().
+ */
+ void SetAndShowDefaultStyle(const wxRichTextAttr& attr)
+ {
+ SetDefaultStyle(attr);
+ SetCaretPositionForDefaultStyle(GetCaretPosition());
+ }
+
+ /**
+ Returns the first visible point in the window.
+ */
+ wxPoint GetFirstVisiblePoint() const;
+
+#ifdef DOXYGEN
+ /**
+ Returns the content of the entire control as a string.
+ */
+ virtual wxString GetValue() const;
+
+ /**
+ Replaces existing content with the given text.
+ */
+ virtual void SetValue(const wxString& value);
+
+ /**
+ Call this function to prevent refresh and allow fast updates, and then Thaw() to
+ refresh the control.
+ */
+ void Freeze();
+
+ /**
+ Call this function to end a Freeze and refresh the display.
+ */
+ void Thaw();
+
+ /**
+ Returns @true if Freeze has been called without a Thaw.
+ */
+ bool IsFrozen() const;
+
+#endif
+
+// Implementation
+
+ /**
+ Sets up the caret for the given position and container, after a mouse click.
+ */
+ bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox* container, long position, int hitTestFlags, bool extendSelection = false);
+
+ /**
+ Find the caret position for the combination of hit-test flags and character position.
+ Returns the caret position and also an indication of where to place the caret (caretLineStart)
+ since this is ambiguous (same position used for end of line and start of next).
+ */
+ long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container,
+ bool& caretLineStart);
+
+ /**
+ Processes mouse movement in order to change the cursor
+ */
+ virtual bool ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj, long position, const wxPoint& pos);
+
+ /**
+ Font names take a long time to retrieve, so cache them (on demand).
+ */
+ static const wxArrayString& GetAvailableFontNames();
+
+ /**
+ Clears the cache of available font names.
+ */
+ static void ClearAvailableFontNames();
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+ // implement wxTextEntry methods
+ virtual wxString DoGetValue() const;
+
+protected:
+ // implement the wxTextEntry pure virtual method
+ virtual wxWindow *GetEditableWindow() { return this; }
+
+ // margins functions
+ virtual bool DoSetMargins(const wxPoint& pt);
+ virtual wxPoint DoGetMargins() const;
+
+ // FIXME: this does not work, it allows this code to compile but will fail
+ // during run-time
+#ifndef __WXUNIVERSAL__
+#ifdef __WXMSW__
+ virtual WXHWND GetEditHWND() const { return GetHWND(); }
+#endif
+#ifdef __WXMOTIF__
+ virtual WXWidget GetTextWidget() const { return NULL; }
+#endif
+#ifdef __WXGTK20__
+ virtual GtkEditable *GetEditable() const { return NULL; }
+ virtual GtkEntry *GetEntry() const { return NULL; }
+#endif
+#endif // !__WXUNIVERSAL__
+
+// Overrides
+protected:
+
+ /**
+ Currently this simply returns @c wxSize(10, 10).
+ */
+ virtual wxSize DoGetBestSize() const ;
+
+ virtual void DoSetValue(const wxString& value, int flags = 0);
+
+ virtual void DoThaw();
+
+
+// Data members
+protected:
+#if wxRICHTEXT_BUFFERED_PAINTING
+ /// Buffer bitmap
+ wxBitmap m_bufferBitmap;
+#endif
+
+ /// Text buffer
+ wxRichTextBuffer m_buffer;
+
+ wxMenu* m_contextMenu;
+
+ /// Caret position (1 less than the character position, so -1 is the
+ /// first caret position).
+ long m_caretPosition;
+
+ /// Caret position when the default formatting has been changed. As
+ /// soon as this position changes, we no longer reflect the default style
+ /// in the UI.
+ long m_caretPositionForDefaultStyle;
+
+ /// Selection range in character positions. -2, -2 means no selection.
+ wxRichTextSelection m_selection;
+
+ wxRichTextCtrlSelectionState m_selectionState;
+
+ /// Anchor so we know how to extend the selection
+ /// It's a caret position since it's between two characters.
+ long m_selectionAnchor;
+
+ /// Anchor object if selecting multiple container objects, such as grid cells.
+ wxRichTextObject* m_selectionAnchorObject;
+
+ /// Are we editable?
+ bool m_editable;
+
+ /// Are we showing the caret position at the start of a line
+ /// instead of at the end of the previous one?
+ bool m_caretAtLineStart;
+
+ /// Are we dragging a selection?
+ bool m_dragging;
+
+ /// Do we need full layout in idle?
+ bool m_fullLayoutRequired;
+ wxLongLong m_fullLayoutTime;
+ long m_fullLayoutSavedPosition;
+
+ /// Threshold for doing delayed layout
+ long m_delayedLayoutThreshold;
+
+ /// Cursors
+ wxCursor m_textCursor;
+ wxCursor m_urlCursor;
+
+ static wxArrayString sm_availableFontNames;
+
+ wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo;
+
+ /// The object that currently has the editing focus
+ wxRichTextParagraphLayoutBox* m_focusObject;
+};
+
+/**
+ @class wxRichTextEvent
+
+ This is the event class for wxRichTextCtrl notifications.
+
+ @beginEventTable{wxRichTextEvent}
+ @event{EVT_RICHTEXT_LEFT_CLICK(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_LEFT_CLICK event, generated when the user
+ releases the left mouse button over an object.
+ @event{EVT_RICHTEXT_RIGHT_CLICK(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK event, generated when the user
+ releases the right mouse button over an object.
+ @event{EVT_RICHTEXT_MIDDLE_CLICK(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK event, generated when the user
+ releases the middle mouse button over an object.
+ @event{EVT_RICHTEXT_LEFT_DCLICK(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK event, generated when the user
+ double-clicks an object.
+ @event{EVT_RICHTEXT_RETURN(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_RETURN event, generated when the user
+ presses the return key. Valid event functions: GetFlags, GetPosition.
+ @event{EVT_RICHTEXT_CHARACTER(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_CHARACTER event, generated when the user
+ presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter.
+ @event{EVT_RICHTEXT_DELETE(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_DELETE event, generated when the user
+ presses the backspace or delete key. Valid event functions: GetFlags, GetPosition.
+ @event{EVT_RICHTEXT_RETURN(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_RETURN event, generated when the user
+ presses the return key. Valid event functions: GetFlags, GetPosition.
+ @event{EVT_RICHTEXT_STYLE_CHANGED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED event, generated when
+ styling has been applied to the control. Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_STYLESHEET_CHANGED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING event, generated
+ when the control's stylesheet has changed, for example the user added,
+ edited or deleted a style. Valid event functions: GetRange, GetPosition.
+ @event{EVT_RICHTEXT_STYLESHEET_REPLACING(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING event, generated
+ when the control's stylesheet is about to be replaced, for example when
+ a file is loaded into the control.
+ Valid event functions: Veto, GetOldStyleSheet, GetNewStyleSheet.
+ @event{EVT_RICHTEXT_STYLESHEET_REPLACED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED event, generated
+ when the control's stylesheet has been replaced, for example when a file
+ is loaded into the control.
+ Valid event functions: GetOldStyleSheet, GetNewStyleSheet.
+ @event{EVT_RICHTEXT_PROPERTIES_CHANGED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED event, generated when
+ properties have been applied to the control. Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_CONTENT_INSERTED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED event, generated when
+ content has been inserted into the control.
+ Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_CONTENT_DELETED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED event, generated when
+ content has been deleted from the control.
+ Valid event functions: GetPosition, GetRange.
+ @event{EVT_RICHTEXT_BUFFER_RESET(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_BUFFER_RESET event, generated when the
+ buffer has been reset by deleting all content.
+ You can use this to set a default style for the first new paragraph.
+ @event{EVT_RICHTEXT_SELECTION_CHANGED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED event, generated when the
+ selection range has changed.
+ @event{EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, func)}
+ Process a @c wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED event, generated when the
+ current focus object has changed.
+ @endEventTable
+
+ @library{wxrichtext}
+ @category{events,richtext}
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent
+{
+public:
+ /**
+ Constructor.
+
+ @param commandType
+ The type of the event.
+ @param id
+ Window identifier. The value @c wxID_ANY indicates a default value.
+ */
+ wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
+ : wxNotifyEvent(commandType, winid),
+ m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL),
+ m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL)
+ { }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextEvent(const wxRichTextEvent& event)
+ : wxNotifyEvent(event),
+ m_flags(event.m_flags), m_position(-1),
+ m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet),
+ m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer)
+ { }
+
+ /**
+ Returns the buffer position at which the event occurred.
+ */
+ long GetPosition() const { return m_position; }
+
+ /**
+ Sets the buffer position variable.
+ */
+ void SetPosition(long pos) { m_position = pos; }
+
+ /**
+ Returns flags indicating modifier keys pressed.
+
+ Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets flags indicating modifier keys pressed.
+
+ Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Returns the old style sheet.
+
+ Can be used in a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or
+ @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler.
+ */
+ wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; }
+
+ /**
+ Sets the old style sheet variable.
+ */
+ void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; }
+
+ /**
+ Returns the new style sheet.
+
+ Can be used in a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or
+ @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler.
+ */
+ wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; }
+
+ /**
+ Sets the new style sheet variable.
+ */
+ void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; }
+
+ /**
+ Gets the range for the current operation.
+ */
+ const wxRichTextRange& GetRange() const { return m_range; }
+
+ /**
+ Sets the range variable.
+ */
+ void SetRange(const wxRichTextRange& range) { m_range = range; }
+
+ /**
+ Returns the character pressed, within a @c wxEVT_COMMAND_RICHTEXT_CHARACTER event.
+ */
+ wxChar GetCharacter() const { return m_char; }
+
+ /**
+ Sets the character variable.
+ */
+ void SetCharacter(wxChar ch) { m_char = ch; }
+
+ /**
+ Returns the container for which the event is relevant.
+ */
+ wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; }
+
+ /**
+ Sets the container for which the event is relevant.
+ */
+ void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; }
+
+ /**
+ Returns the old container, for a focus change event.
+ */
+ wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; }
+
+ /**
+ Sets the old container, for a focus change event.
+ */
+ void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; }
+
+ virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); }
+
+protected:
+ int m_flags;
+ long m_position;
+ wxRichTextStyleSheet* m_oldStyleSheet;
+ wxRichTextStyleSheet* m_newStyleSheet;
+ wxRichTextRange m_range;
+ wxChar m_char;
+ wxRichTextParagraphLayoutBox* m_container;
+ wxRichTextParagraphLayoutBox* m_oldContainer;
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent)
+};