| Version: 3.3.1

Public Member Functions | List of all members
wxDataViewEvent Class Reference
Class List by Category » Events | Class List by Category » wxDataViewCtrl Related Classes

`#include <wx/dataview.h>`

Inheritance diagram for wxDataViewEvent:
[legend]

## Detailed Description

This is the event class for the wxDataViewCtrl notifications.

## Events using this class

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

void handlerFuncName(wxDataViewEvent& event)

Event macros:

- EVT_DATAVIEW_SELECTION_CHANGED(id, func):
  Process a `wxEVT_DATAVIEW_SELECTION_CHANGED` event.
- EVT_DATAVIEW_ITEM_ACTIVATED(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_ACTIVATED` event.
- EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_EDITING_STARTED` event.
- EVT_DATAVIEW_ITEM_EDITING_DONE(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_EDITING_DONE` event.
- EVT_DATAVIEW_ITEM_COLLAPSING(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_COLLAPSING` event.
- EVT_DATAVIEW_ITEM_COLLAPSED(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_COLLAPSED` event.
- EVT_DATAVIEW_ITEM_EXPANDING(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_EXPANDING` event.
- EVT_DATAVIEW_ITEM_EXPANDED(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_EXPANDED` event.
- EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_VALUE_CHANGED` event.
- EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_CONTEXT_MENU` event.
- EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func):
  Process a `wxEVT_DATAVIEW_COLUMN_HEADER_CLICK` event.
- EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func):
  Process a `wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK` event.
- EVT_DATAVIEW_COLUMN_SORTED(id, func):
  Process a `wxEVT_DATAVIEW_COLUMN_SORTED` event.
- EVT_DATAVIEW_COLUMN_REORDERED(id, func):
  Process a `wxEVT_DATAVIEW_COLUMN_REORDERED` event. Currently this event is not generated when using the native GTK+ version of the control.
- EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_BEGIN_DRAG` event which is generated when the user starts dragging a valid item. This event must be processed and wxDataViewEvent::SetDataObject() must be called to actually start dragging the item.
- EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE` event.
- EVT_DATAVIEW_ITEM_DROP(id, func):
  Process a `wxEVT_DATAVIEW_ITEM_DROP` event.
- EVT_DATAVIEW_CACHE_HINT(id, func):
  Process a `wxEVT_DATAVIEW_CACHE_HINT` event.

##

Library: wxCore
Category: Events, wxDataViewCtrl Related Classes

## Public Member Functions
| wxDataViewEvent ()
| Default ctor, normally shouldn't be used and mostly exists only for backwards compatibility. More...
| wxDataViewEvent (wxEventType evtType, wxDataViewCtrl *dvc, wxDataViewColumn *column, const wxDataViewItem &item=wxDataViewItem())
| Constructor for the events affecting columns (and possibly also items). More...
| wxDataViewEvent (wxEventType evtType, wxDataViewCtrl *dvc, const wxDataViewItem &item)
| Constructor for the events affecting only the items. More...
| wxDataViewEvent (const wxDataViewEvent &event)
| Copy constructor. More...
int | GetColumn () const
| Returns the position of the column in the control or -1 if column field is unavailable for this event. More...
wxDataViewColumn * | GetDataViewColumn () const
| Returns a pointer to the wxDataViewColumn from which the event was emitted or nullptr. More...
wxDataViewModel * | GetModel () const
| Returns the wxDataViewModel associated with the event. More...
wxPoint | GetPosition () const
| Returns the position of a context menu event in client coordinates. More...
const wxVariant & | GetValue () const
| Returns a reference to a value. More...
bool | IsEditCancelled () const
| Can be used to determine whether the new value is going to be accepted in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler. More...
void | SetColumn (int col)
| Sets the column index associated with this event. More...
void | SetDataViewColumn (wxDataViewColumn *col)
| For `wxEVT_DATAVIEW_COLUMN_HEADER_CLICK` only. More...
void | SetModel (wxDataViewModel *model)
| Sets the dataview model associated with this event. More...
void | SetValue (const wxVariant &value)
| Sets the value associated with this event. More...
void | SetDataObject (wxDataObject *obj)
| Set wxDataObject for data transfer within a drag operation. More...
wxDataFormat | GetDataFormat () const
| Gets the wxDataFormat during a drop operation. More...
size_t | GetDataSize () const
| Gets the data size for a drop data transfer. More...
void * | GetDataBuffer () const
| Gets the data buffer for a drop data transfer. More...
void | SetDragFlags (int flags)
| Specify the kind of the drag operation to perform. More...
wxDragResult | GetDropEffect () const
| Returns the effect the user requested to happen to the dropped data. More...
int | GetCacheFrom () const
| Return the first row that will be displayed. More...
int | GetCacheTo () const
| Return the last row that will be displayed. More...
int | GetProposedDropIndex () const
| Returns the index of the child item at which an item currently being dragged would be dropped. More...
wxDataViewItem | GetItem () const
| Returns the item affected by the event. More...
void | SetItem (const wxDataViewItem &item)
void | SetPosition (int x, int y)
void | SetCache (int from, int to)
wxDataObject * | GetDataObject () const
void | SetDataFormat (const wxDataFormat &format)
void | SetDataSize (size_t size)
void | SetDataBuffer (void *buf)
int | GetDragFlags () const
void | SetDropEffect (wxDragResult effect)
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...
virtual wxEvent * | Clone () const =0
| Returns a copy of the event. 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 nullptr 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=nullptr, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. 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...
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...

## Constructor & Destructor Documentation

## ◆ wxDataViewEvent() [1/4]

wxDataViewEvent::wxDataViewEvent | ( |  | ) |

Default ctor, normally shouldn't be used and mostly exists only for backwards compatibility.

## ◆ wxDataViewEvent() [2/4]

wxDataViewEvent::wxDataViewEvent | ( | wxEventType | evtType,
|  | wxDataViewCtrl * | dvc,
|  | wxDataViewColumn * | column,
|  | const wxDataViewItem & | item = `wxDataViewItem()`
| ) |  |

Constructor for the events affecting columns (and possibly also items).

## ◆ wxDataViewEvent() [3/4]

wxDataViewEvent::wxDataViewEvent | ( | wxEventType | evtType,
|  | wxDataViewCtrl * | dvc,
|  | const wxDataViewItem & | item
| ) |  |

Constructor for the events affecting only the items.

## ◆ wxDataViewEvent() [4/4]

wxDataViewEvent::wxDataViewEvent | ( | const wxDataViewEvent & | event | ) |

Copy constructor.

## Member Function Documentation

## ◆ GetCacheFrom()

int wxDataViewEvent::GetCacheFrom | ( |  | ) | const

Return the first row that will be displayed.

## ◆ GetCacheTo()

int wxDataViewEvent::GetCacheTo | ( |  | ) | const

Return the last row that will be displayed.

## ◆ GetColumn()

int wxDataViewEvent::GetColumn | ( |  | ) | const

Returns the position of the column in the control or -1 if column field is unavailable for this event.

For wxEVT_DATAVIEW_COLUMN_REORDERED, this is the new position of the column.

## ◆ GetDataBuffer()

void* wxDataViewEvent::GetDataBuffer | ( |  | ) | const

Gets the data buffer for a drop data transfer.

## ◆ GetDataFormat()

wxDataFormat wxDataViewEvent::GetDataFormat | ( |  | ) | const

Gets the wxDataFormat during a drop operation.

## ◆ GetDataObject()

wxDataObject* wxDataViewEvent::GetDataObject | ( |  | ) | const

## ◆ GetDataSize()

size_t wxDataViewEvent::GetDataSize | ( |  | ) | const

Gets the data size for a drop data transfer.

## ◆ GetDataViewColumn()

wxDataViewColumn* wxDataViewEvent::GetDataViewColumn | ( |  | ) | const

Returns a pointer to the wxDataViewColumn from which the event was emitted or nullptr.

## ◆ GetDragFlags()

int wxDataViewEvent::GetDragFlags | ( |  | ) | const

## ◆ GetDropEffect()

wxDragResult wxDataViewEvent::GetDropEffect | ( |  | ) | const

Returns the effect the user requested to happen to the dropped data.

This function can be used inside wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE and wxEVT_DATAVIEW_ITEM_DROP handlers and returns whether the user is trying to copy (the return value is wxDragCopy) or move (if the return value is wxDragMove) the data.

Currently this is only available when using the generic version of wxDataViewCtrl (used e.g. under MSW) and always returns wxDragNone in the GTK and macOS native versions.

Since
  2.9.4

## ◆ GetItem()

wxDataViewItem wxDataViewEvent::GetItem | ( |  | ) | const

Returns the item affected by the event.

Notice that for `wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE` and `wxEVT_DATAVIEW_ITEM_DROP` event handlers, the item may be invalid, indicating that the drop is about to happen outside of the item area.

## ◆ GetModel()

wxDataViewModel* wxDataViewEvent::GetModel | ( |  | ) | const

Returns the wxDataViewModel associated with the event.

## ◆ GetPosition()

wxPoint wxDataViewEvent::GetPosition | ( |  | ) | const

Returns the position of a context menu event in client coordinates.

## ◆ GetProposedDropIndex()

int wxDataViewEvent::GetProposedDropIndex | ( |  | ) | const

Returns the index of the child item at which an item currently being dragged would be dropped.

This function can be used from wxEVT_DATAVIEW_ITEM_DROP (in all ports) and wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE (except when using native GTK implementation) handlers to determine the exact position of the item being dropped.

Since
  3.1.2

## ◆ GetValue()

const wxVariant& wxDataViewEvent::GetValue | ( |  | ) | const

Returns a reference to a value.

## ◆ IsEditCancelled()

bool wxDataViewEvent::IsEditCancelled | ( |  | ) | const

Can be used to determine whether the new value is going to be accepted in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler.

Returns true if editing the item was cancelled or if the user tried to enter an invalid value (refused by wxDataViewRenderer::Validate()). If this method returns false, it means that the value in the model is about to be changed to the new one.

Notice that wxEVT_DATAVIEW_ITEM_EDITING_DONE event handler can call wxNotifyEvent::Veto() to prevent this from happening.

Currently support for setting this field and for vetoing the change is only available in the generic version of wxDataViewCtrl, i.e. under MSW but not GTK nor macOS.

Since
  2.9.3

## ◆ SetCache()

void wxDataViewEvent::SetCache | ( | int | from,
|  | int | to
| ) |  |

## ◆ SetColumn()

void wxDataViewEvent::SetColumn | ( | int | col | ) |

Sets the column index associated with this event.

## ◆ SetDataBuffer()

void wxDataViewEvent::SetDataBuffer | ( | void * | buf | ) |

## ◆ SetDataFormat()

void wxDataViewEvent::SetDataFormat | ( | const wxDataFormat & | format | ) |

## ◆ SetDataObject()

void wxDataViewEvent::SetDataObject | ( | wxDataObject * | obj | ) |

Set wxDataObject for data transfer within a drag operation.

This method must be used inside a `wxEVT_DATAVIEW_ITEM_BEGIN_DRAG` handler to associate the data object to be dragged with the item.

Note that the control takes ownership of the data object, i.e. obj must be heap-allocated and will be deleted by wxDataViewCtrl itself.

## ◆ SetDataSize()

void wxDataViewEvent::SetDataSize | ( | size_t | size | ) |

## ◆ SetDataViewColumn()

void wxDataViewEvent::SetDataViewColumn | ( | wxDataViewColumn * | col | ) |

For `wxEVT_DATAVIEW_COLUMN_HEADER_CLICK` only.

## ◆ SetDragFlags()

void wxDataViewEvent::SetDragFlags | ( | int | flags | ) |

Specify the kind of the drag operation to perform.

This method can be used inside a `wxEVT_DATAVIEW_ITEM_BEGIN_DRAG` handler in order to configure the drag operation. Valid values are wxDrag_CopyOnly (default), wxDrag_AllowMove (allow the data to be moved) and wxDrag_DefaultMove.

Currently it is only honoured by the generic version of wxDataViewCtrl (used e.g. under MSW) and not supported by the native GTK and macOS versions.

See also
  GetDropEffect()

Since
  2.9.4

## ◆ SetDropEffect()

void wxDataViewEvent::SetDropEffect | ( | wxDragResult | effect | ) |

## ◆ SetItem()

void wxDataViewEvent::SetItem | ( | const wxDataViewItem & | item | ) |

## ◆ SetModel()

void wxDataViewEvent::SetModel | ( | wxDataViewModel * | model | ) |

Sets the dataview model associated with this event.

## ◆ SetPosition()

void wxDataViewEvent::SetPosition | ( | int | x,
|  | int | y
| ) |  |

## ◆ SetValue()

void wxDataViewEvent::SetValue | ( | const wxVariant & | value | ) |

Sets the value associated with this event.