Version: 3.1.0
wxDataViewEvent Class Reference

#include <wx/dataview.h>

+ Inheritance diagram for wxDataViewEvent:

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 even is only generated when using the native OSX version.
  • EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func):
    Process a wxEVT_DATAVIEW_ITEM_BEGIN_DRAG event.
  • 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:  wxAdvanced
Category:  Events, wxDataViewCtrl Related Classes

Public Member Functions

 wxDataViewEvent (wxEventType commandType=wxEVT_NULL, int winid=0)
 Constructor.
 
int GetColumn () const
 Returns the position of the column in the control or -1 if no column field was set by the event emitter.
 
wxDataViewColumnGetDataViewColumn () const
 Returns a pointer to the wxDataViewColumn from which the event was emitted or NULL.
 
wxDataViewModelGetModel () const
 Returns the wxDataViewModel associated with the event.
 
wxPoint GetPosition () const
 Returns the position of a context menu event in screen coordinates.
 
const wxVariantGetValue () const
 Returns a reference to a value.
 
bool IsEditCancelled () const
 Can be used to determine whether the new value is going to be accepted in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler.
 
void SetColumn (int col)
 Sets the column index associated with this event.
 
void SetDataViewColumn (wxDataViewColumn *col)
 For wxEVT_DATAVIEW_COLUMN_HEADER_CLICK only.
 
void SetModel (wxDataViewModel *model)
 Sets the dataview model associated with this event.
 
void SetValue (const wxVariant &value)
 Sets the value associated with this event.
 
void SetDataObject (wxDataObject *obj)
 Set wxDataObject for data transfer within a drag operation.
 
wxDataFormat GetDataFormat () const
 Gets the wxDataFormat during a drop operation.
 
size_t GetDataSize () const
 Gets the data size for a drop data transfer.
 
void * GetDataBuffer () const
 Gets the data buffer for a drop data transfer.
 
void SetDragFlags (int flags)
 Specify the kind of the drag operation to perform.
 
wxDragResult GetDropEffect () const
 Returns the effect the user requested to happen to the dropped data.
 
int GetCacheFrom () const
 Return the first row that will be displayed.
 
int GetCacheTo () const
 Return the last row that will be displayed.
 
wxDataViewItem GetItem () const
 Returns the item affected by the event.
 
void SetItem (const wxDataViewItem &item)
 
void SetEditCanceled (bool editCancelled)
 
void SetPosition (int x, int y)
 
void SetCache (int from, int to)
 
wxDataObjectGetDataObject () 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).
 
void Allow ()
 This is the opposite of Veto(): it explicitly allows the event to be processed.
 
bool IsAllowed () const
 Returns true if the change is allowed (Veto() hasn't been called) or false otherwise (if it was).
 
void Veto ()
 Prevents the change announced by this event from happening.
 
- Public Member Functions inherited from wxCommandEvent
 wxCommandEvent (wxEventType commandEventType=wxEVT_NULL, int id=0)
 Constructor.
 
void * GetClientData () const
 Returns client data pointer for a listbox or choice selection event (not valid for a deselection).
 
wxClientDataGetClientObject () const
 Returns client object pointer for a listbox or choice selection event (not valid for a deselection).
 
long GetExtraLong () const
 Returns extra information dependent on the event objects type.
 
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.
 
int GetSelection () const
 Returns item index for a listbox or choice selection event (not valid for a deselection).
 
wxString GetString () const
 Returns item string for a listbox or choice selection event.
 
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.
 
bool IsSelection () const
 For a listbox or similar event, returns true if it is a selection, false if it is a deselection.
 
void SetClientData (void *clientData)
 Sets the client data for this event.
 
void SetClientObject (wxClientData *clientObject)
 Sets the client object for this event.
 
void SetExtraLong (long extraLong)
 Sets the m_extraLong member.
 
void SetInt (int intCommand)
 Sets the m_commandInt member.
 
void SetString (const wxString &string)
 Sets the m_commandString member.
 
- Public Member Functions inherited from wxEvent
 wxEvent (int id=0, wxEventType eventType=wxEVT_NULL)
 Constructor.
 
virtual wxEventClone () const =0
 Returns a copy of the event.
 
wxObjectGetEventObject () const
 Returns the object (usually a window) associated with the event, if any.
 
wxEventType GetEventType () const
 Returns the identifier of the given event type, such as wxEVT_BUTTON.
 
virtual wxEventCategory GetEventCategory () const
 Returns a generic category for this event.
 
int GetId () const
 Returns the identifier associated with this event, such as a button command id.
 
wxObjectGetEventUserData () const
 Return the user data associated with a dynamically connected event handler.
 
bool GetSkipped () const
 Returns true if the event handler should be skipped, false otherwise.
 
long GetTimestamp () const
 Gets the timestamp for the event.
 
bool IsCommandEvent () const
 Returns true if the event is or is derived from wxCommandEvent else it returns false.
 
void ResumePropagation (int propagationLevel)
 Sets the propagation level to the given value (for example returned from an earlier call to wxEvent::StopPropagation).
 
void SetEventObject (wxObject *object)
 Sets the originating object.
 
void SetEventType (wxEventType type)
 Sets the event type.
 
void SetId (int id)
 Sets the identifier associated with this event, such as a button command id.
 
void SetTimestamp (long timeStamp=0)
 Sets the timestamp for the event.
 
bool ShouldPropagate () const
 Test if this event should be propagated or not, i.e. if the propagation level is currently greater than 0.
 
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.
 
int StopPropagation ()
 Stop the event from propagating to its parent window.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object.
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
 
- Protected Attributes inherited from wxEvent
int m_propagationLevel
 Indicates how many levels the event can propagate.
 

Constructor & Destructor Documentation

wxDataViewEvent::wxDataViewEvent ( wxEventType  commandType = wxEVT_NULL,
int  winid = 0 
)

Constructor.

Typically used by wxWidgets internals only.

Member Function Documentation

int wxDataViewEvent::GetCacheFrom ( ) const

Return the first row that will be displayed.

int wxDataViewEvent::GetCacheTo ( ) const

Return the last row that will be displayed.

int wxDataViewEvent::GetColumn ( ) const

Returns the position of the column in the control or -1 if no column field was set by the event emitter.

void* wxDataViewEvent::GetDataBuffer ( ) const

Gets the data buffer for a drop data transfer.

wxDataFormat wxDataViewEvent::GetDataFormat ( ) const

Gets the wxDataFormat during a drop operation.

wxDataObject* wxDataViewEvent::GetDataObject ( ) const
size_t wxDataViewEvent::GetDataSize ( ) const

Gets the data size for a drop data transfer.

wxDataViewColumn* wxDataViewEvent::GetDataViewColumn ( ) const

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

int wxDataViewEvent::GetDragFlags ( ) const
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 OS X native versions.

Since
2.9.4
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.

wxDataViewModel* wxDataViewEvent::GetModel ( ) const

Returns the wxDataViewModel associated with the event.

wxPoint wxDataViewEvent::GetPosition ( ) const

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

const wxVariant& wxDataViewEvent::GetValue ( ) const

Returns a reference to a value.

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 OS X.

Since
2.9.3
void wxDataViewEvent::SetCache ( int  from,
int  to 
)
void wxDataViewEvent::SetColumn ( int  col)

Sets the column index associated with this event.

void wxDataViewEvent::SetDataBuffer ( void *  buf)
void wxDataViewEvent::SetDataFormat ( const wxDataFormat format)
void wxDataViewEvent::SetDataObject ( wxDataObject obj)

Set wxDataObject for data transfer within a drag operation.

void wxDataViewEvent::SetDataSize ( size_t  size)
void wxDataViewEvent::SetDataViewColumn ( wxDataViewColumn col)

For wxEVT_DATAVIEW_COLUMN_HEADER_CLICK only.

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 OS X versions.

See Also
GetDropEffect()
Since
2.9.4
void wxDataViewEvent::SetDropEffect ( wxDragResult  effect)
void wxDataViewEvent::SetEditCanceled ( bool  editCancelled)
void wxDataViewEvent::SetItem ( const wxDataViewItem item)
void wxDataViewEvent::SetModel ( wxDataViewModel model)

Sets the dataview model associated with this event.

void wxDataViewEvent::SetPosition ( int  x,
int  y 
)
void wxDataViewEvent::SetValue ( const wxVariant value)

Sets the value associated with this event.