| Version: 3.2.5

Public Member Functions | Protected Attributes | List of all members
wxRichTextEvent Class Reference
Class List by Category » Events | Class List by Category » Rich Text

`#include <wx/richtext/richtextctrl.h>`

Inheritance diagram for wxRichTextEvent:
[legend]

## Detailed Description

This is the event class for wxRichTextCtrl notifications.

## Events using this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxRichTextEvent& event)

Event macros:

- EVT_RICHTEXT_LEFT_CLICK(id, func):
  Process a `wxEVT_RICHTEXT_LEFT_CLICK` event, generated when the user releases the left mouse button over an object.
- EVT_RICHTEXT_RIGHT_CLICK(id, func):
  Process a `wxEVT_RICHTEXT_RIGHT_CLICK` event, generated when the user releases the right mouse button over an object.
- EVT_RICHTEXT_MIDDLE_CLICK(id, func):
  Process a `wxEVT_RICHTEXT_MIDDLE_CLICK` event, generated when the user releases the middle mouse button over an object.
- EVT_RICHTEXT_LEFT_DCLICK(id, func):
  Process a `wxEVT_RICHTEXT_LEFT_DCLICK` event, generated when the user double-clicks an object.
- EVT_RICHTEXT_RETURN(id, func):
  Process a `wxEVT_RICHTEXT_RETURN` event, generated when the user presses the return key. Valid event functions: GetFlags, GetPosition.
- EVT_RICHTEXT_CHARACTER(id, func):
  Process a `wxEVT_RICHTEXT_CHARACTER` event, generated when the user presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter.
- EVT_RICHTEXT_CONSUMING_CHARACTER(id, func):
  Process a `wxEVT_RICHTEXT_CONSUMING_CHARACTER` event, generated when the user presses a character key but before it is processed and inserted into the control. Call Veto to prevent normal processing. Valid event functions: GetFlags, GetPosition, GetCharacter, Veto.
- EVT_RICHTEXT_DELETE(id, func):
  Process a `wxEVT_RICHTEXT_DELETE` event, generated when the user presses the backspace or delete key. Valid event functions: GetFlags, GetPosition.
- EVT_RICHTEXT_RETURN(id, func):
  Process a `wxEVT_RICHTEXT_RETURN` event, generated when the user presses the return key. Valid event functions: GetFlags, GetPosition.
- EVT_RICHTEXT_STYLE_CHANGED(id, func):
  Process a `wxEVT_RICHTEXT_STYLE_CHANGED` event, generated when styling has been applied to the control. Valid event functions: GetPosition, GetRange.
- EVT_RICHTEXT_STYLESHEET_CHANGED(id, func):
  Process a `wxEVT_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.
- EVT_RICHTEXT_STYLESHEET_REPLACING(id, func):
  Process a `wxEVT_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.
- EVT_RICHTEXT_STYLESHEET_REPLACED(id, func):
  Process a `wxEVT_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.
- EVT_RICHTEXT_PROPERTIES_CHANGED(id, func):
  Process a `wxEVT_RICHTEXT_PROPERTIES_CHANGED` event, generated when properties have been applied to the control. Valid event functions: GetPosition, GetRange.
- EVT_RICHTEXT_CONTENT_INSERTED(id, func):
  Process a `wxEVT_RICHTEXT_CONTENT_INSERTED` event, generated when content has been inserted into the control. Valid event functions: GetPosition, GetRange.
- EVT_RICHTEXT_CONTENT_DELETED(id, func):
  Process a `wxEVT_RICHTEXT_CONTENT_DELETED` event, generated when content has been deleted from the control. Valid event functions: GetPosition, GetRange.
- EVT_RICHTEXT_BUFFER_RESET(id, func):
  Process a `wxEVT_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.
- EVT_RICHTEXT_SELECTION_CHANGED(id, func):
  Process a `wxEVT_RICHTEXT_SELECTION_CHANGED` event, generated when the selection range has changed.
- EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, func):
  Process a `wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED` event, generated when the current focus object has changed.

##

Library: wxRichText
Category: Events, Rich Text

## Public Member Functions

| wxRichTextEvent (wxEventType commandType=wxEVT_NULL, int winid=0)
| Constructor. More...
| wxRichTextEvent (const wxRichTextEvent &event)
| Copy constructor. More...
long | GetPosition () const
| Returns the buffer position at which the event occurred. More...
void | SetPosition (long pos)
| Sets the buffer position variable. More...
int | GetFlags () const
| Returns flags indicating modifier keys pressed. More...
void | SetFlags (int flags)
| Sets flags indicating modifier keys pressed. More...
wxRichTextStyleSheet * | GetOldStyleSheet () const
| Returns the old style sheet. More...
void | SetOldStyleSheet (wxRichTextStyleSheet *sheet)
| Sets the old style sheet variable. More...
wxRichTextStyleSheet * | GetNewStyleSheet () const
| Returns the new style sheet. More...
void | SetNewStyleSheet (wxRichTextStyleSheet *sheet)
| Sets the new style sheet variable. More...
const wxRichTextRange & | GetRange () const
| Gets the range for the current operation. More...
void | SetRange (const wxRichTextRange &range)
| Sets the range variable. More...
wxChar | GetCharacter () const
| Returns the character pressed, within a `wxEVT_RICHTEXT_CHARACTER` event. More...
void | SetCharacter (wxChar ch)
| Sets the character variable. More...
wxRichTextParagraphLayoutBox * | GetContainer () const
| Returns the container for which the event is relevant. More...
void | SetContainer (wxRichTextParagraphLayoutBox *container)
| Sets the container for which the event is relevant. More...
wxRichTextParagraphLayoutBox * | GetOldContainer () const
| Returns the old container, for a focus change event. More...
void | SetOldContainer (wxRichTextParagraphLayoutBox *container)
| Sets the old container, for a focus change event. More...
virtual wxEvent * | Clone () const
| Returns a copy of the event. More...
Public Member Functions inherited from wxNotifyEvent
| wxNotifyEvent (wxEventType eventType=wxEVT_NULL, int id=0)
| Constructor (used internally by wxWidgets only). More...
void | Allow ()
| This is the opposite of Veto(): it explicitly allows the event to be processed. More...
bool | IsAllowed () const
| Returns true if the change is allowed (Veto() hasn't been called) or false otherwise (if it was). More...
void | Veto ()
| Prevents the change announced by this event from happening. More...
Public Member Functions inherited from wxCommandEvent
| wxCommandEvent (wxEventType commandEventType=wxEVT_NULL, int id=0)
| Constructor. More...
void * | GetClientData () const
| Returns client data pointer for a listbox or choice selection event (not valid for a deselection). More...
wxClientData * | GetClientObject () const
| Returns client object pointer for a listbox or choice selection event (not valid for a deselection). More...
long | GetExtraLong () const
| Returns extra information dependent on the event objects type. More...
int | GetInt () const
| Returns the integer identifier corresponding to a listbox, choice or radiobox selection (only if the event was a selection, not a deselection), or a boolean value representing the value of a checkbox. More...
int | GetSelection () const
| Returns item index for a listbox or choice selection event (not valid for a deselection). More...
wxString | GetString () const
| Returns item string for a listbox or choice selection event. More...
bool | IsChecked () const
| This method can be used with checkbox and menu events: for the checkboxes, the method returns true for a selection event and false for a deselection one. More...
bool | IsSelection () const
| For a listbox or similar event, returns true if it is a selection, false if it is a deselection. More...
void | SetClientData (void *clientData)
| Sets the client data for this event. More...
void | SetClientObject (wxClientData *clientObject)
| Sets the client object for this event. More...
void | SetExtraLong (long extraLong)
| Sets the m_extraLong member. More...
void | SetInt (int intCommand)
| Sets the m_commandInt member. More...
void | SetString (const wxString &string)
| Sets the m_commandString member. More...
Public Member Functions inherited from wxEvent
| wxEvent (int id=0, wxEventType eventType=wxEVT_NULL)
| Constructor. More...
wxObject * | GetEventObject () const
| Returns the object (usually a window) associated with the event, if any. More...
wxEventType | GetEventType () const
| Returns the identifier of the given event type, such as `wxEVT_BUTTON`. More...
virtual wxEventCategory | GetEventCategory () const
| Returns a generic category for this event. More...
int | GetId () const
| Returns the identifier associated with this event, such as a button command id. More...
wxObject * | GetEventUserData () const
| Return the user data associated with a dynamically connected event handler. More...
bool | GetSkipped () const
| Returns true if the event handler should be skipped, false otherwise. More...
long | GetTimestamp () const
| Gets the timestamp for the event. More...
bool | IsCommandEvent () const
| Returns true if the event is or is derived from wxCommandEvent else it returns false. More...
void | ResumePropagation (int propagationLevel)
| Sets the propagation level to the given value (for example returned from an earlier call to wxEvent::StopPropagation). More...
void | SetEventObject (wxObject *object)
| Sets the originating object. More...
void | SetEventType (wxEventType type)
| Sets the event type. More...
void | SetId (int id)
| Sets the identifier associated with this event, such as a button command id. More...
void | SetTimestamp (long timeStamp=0)
| Sets the timestamp for the event. More...
bool | ShouldPropagate () const
| Test if this event should be propagated or not, i.e. if the propagation level is currently greater than 0. More...
void | Skip (bool skip=true)
| This method can be used inside an event handler to control whether further event handlers bound to this event will be called after the current one returns. More...
int | StopPropagation ()
| Stop the event from propagating to its parent window. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...

## Protected Attributes

int | m_flags
long | m_position
wxRichTextStyleSheet * | m_oldStyleSheet
wxRichTextStyleSheet * | m_newStyleSheet
wxRichTextRange | m_range
wxChar | m_char
wxRichTextParagraphLayoutBox * | m_container
wxRichTextParagraphLayoutBox * | m_oldContainer
Protected Attributes inherited from wxEvent
int | m_propagationLevel
| Indicates how many levels the event can propagate. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Additional Inherited Members

Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...

## Constructor & Destructor Documentation

## ◆ wxRichTextEvent() [1/2]

wxRichTextEvent::wxRichTextEvent | ( | wxEventType | commandType = `wxEVT_NULL`,
|  | int | winid = `0`
| ) |  |

Constructor.

Parameters

  commandType | The type of the event.
  winid | Window identifier. The value `wxID_ANY` indicates a default value.

## ◆ wxRichTextEvent() [2/2]

wxRichTextEvent::wxRichTextEvent | ( | const wxRichTextEvent & | event | ) |

Copy constructor.

## Member Function Documentation

## ◆ Clone()

virtual wxEvent* wxRichTextEvent::Clone | ( |  | ) | const

virtual

Returns a copy of the event.

Any event that is posted to the wxWidgets event system for later action (via wxEvtHandler::AddPendingEvent, wxEvtHandler::QueueEvent or wxPostEvent()) must implement this method.

All wxWidgets events fully implement this method, but any derived events implemented by the user should also implement this method just in case they (or some event derived from them) are ever posted.

All wxWidgets events implement a copy constructor, so the easiest way of implementing the Clone function is to implement a copy constructor for a new event (call it MyEvent) and then define the Clone function like this:

wxEvent *Clone() const { return new MyEvent(*this); }
wxEvent
An event is a structure holding information about an event passed to a callback or member function.
Definition: event.h:93
wxRichTextEvent::Clone
virtual wxEvent * Clone() const
Returns a copy of the event.

Implements wxEvent.

## ◆ GetCharacter()

wxChar wxRichTextEvent::GetCharacter | ( |  | ) | const

Returns the character pressed, within a `wxEVT_RICHTEXT_CHARACTER` event.

## ◆ GetContainer()

wxRichTextParagraphLayoutBox* wxRichTextEvent::GetContainer | ( |  | ) | const

Returns the container for which the event is relevant.

## ◆ GetFlags()

int wxRichTextEvent::GetFlags | ( |  | ) | const

Returns flags indicating modifier keys pressed.

Possible values are `wxRICHTEXT_CTRL_DOWN`, `wxRICHTEXT_SHIFT_DOWN`, and `wxRICHTEXT_ALT_DOWN`.

## ◆ GetNewStyleSheet()

wxRichTextStyleSheet* wxRichTextEvent::GetNewStyleSheet | ( |  | ) | const

Returns the new style sheet.

Can be used in a `wxEVT_RICHTEXT_STYLESHEET_CHANGING` or `wxEVT_RICHTEXT_STYLESHEET_CHANGED` event handler.

## ◆ GetOldContainer()

wxRichTextParagraphLayoutBox* wxRichTextEvent::GetOldContainer | ( |  | ) | const

Returns the old container, for a focus change event.

## ◆ GetOldStyleSheet()

wxRichTextStyleSheet* wxRichTextEvent::GetOldStyleSheet | ( |  | ) | const

Returns the old style sheet.

Can be used in a `wxEVT_RICHTEXT_STYLESHEET_CHANGING` or `wxEVT_RICHTEXT_STYLESHEET_CHANGED` event handler.

## ◆ GetPosition()

long wxRichTextEvent::GetPosition | ( |  | ) | const

Returns the buffer position at which the event occurred.

## ◆ GetRange()

const wxRichTextRange& wxRichTextEvent::GetRange | ( |  | ) | const

Gets the range for the current operation.

## ◆ SetCharacter()

void wxRichTextEvent::SetCharacter | ( | wxChar | ch | ) |

Sets the character variable.

## ◆ SetContainer()

void wxRichTextEvent::SetContainer | ( | wxRichTextParagraphLayoutBox * | container | ) |

Sets the container for which the event is relevant.

## ◆ SetFlags()

void wxRichTextEvent::SetFlags | ( | int | flags | ) |

Sets flags indicating modifier keys pressed.

Possible values are `wxRICHTEXT_CTRL_DOWN`, `wxRICHTEXT_SHIFT_DOWN`, and `wxRICHTEXT_ALT_DOWN`.

## ◆ SetNewStyleSheet()

void wxRichTextEvent::SetNewStyleSheet | ( | wxRichTextStyleSheet * | sheet | ) |

Sets the new style sheet variable.

## ◆ SetOldContainer()

void wxRichTextEvent::SetOldContainer | ( | wxRichTextParagraphLayoutBox * | container | ) |

Sets the old container, for a focus change event.

## ◆ SetOldStyleSheet()

void wxRichTextEvent::SetOldStyleSheet | ( | wxRichTextStyleSheet * | sheet | ) |

Sets the old style sheet variable.

## ◆ SetPosition()

void wxRichTextEvent::SetPosition | ( | long | pos | ) |

Sets the buffer position variable.

## ◆ SetRange()

void wxRichTextEvent::SetRange | ( | const wxRichTextRange & | range | ) |

Sets the range variable.

## Member Data Documentation

## ◆ m_char

wxChar wxRichTextEvent::m_char

protected

## ◆ m_container

wxRichTextParagraphLayoutBox* wxRichTextEvent::m_container

protected

## ◆ m_flags

int wxRichTextEvent::m_flags

protected

## ◆ m_newStyleSheet

wxRichTextStyleSheet* wxRichTextEvent::m_newStyleSheet

protected

## ◆ m_oldContainer

wxRichTextParagraphLayoutBox* wxRichTextEvent::m_oldContainer

protected

## ◆ m_oldStyleSheet

wxRichTextStyleSheet* wxRichTextEvent::m_oldStyleSheet

protected

## ◆ m_position

long wxRichTextEvent::m_position

protected

## ◆ m_range

wxRichTextRange wxRichTextEvent::m_range

protected