Document _ITEM_VALUE_CHANGED and implmement it equally as being sent from valueChanged and ItemChanged. Remove other _MODEL_XXX events.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49013 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,37 +35,37 @@ wxDataViewEvent - the event class for the wxDataViewCtrl notifications
|
|||||||
|
|
||||||
\constfunc{wxEvent*}{Clone}{\void}
|
\constfunc{wxEvent*}{Clone}{\void}
|
||||||
|
|
||||||
|
Used to clone the event.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::GetColumn}\label{wxdatavieweventgetcolumn}
|
\membersection{wxDataViewEvent::GetColumn}\label{wxdatavieweventgetcolumn}
|
||||||
|
|
||||||
\constfunc{int}{GetColumn}{\void}
|
\constfunc{int}{GetColumn}{\void}
|
||||||
|
|
||||||
|
Returns the position of the column in the control or -1
|
||||||
|
if no column field was set by the event emitter.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::GetDataViewColumn}\label{wxdatavieweventgetdataviewcolumn}
|
\membersection{wxDataViewEvent::GetDataViewColumn}\label{wxdatavieweventgetdataviewcolumn}
|
||||||
|
|
||||||
\func{wxDataViewColumn*}{GetDataViewColumn}{\void}
|
\func{wxDataViewColumn*}{GetDataViewColumn}{\void}
|
||||||
|
|
||||||
|
Returns a pointer to the wxDataViewColumn from which
|
||||||
|
the event was emitted or NULL.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::GetModel}\label{wxdatavieweventgetmodel}
|
\membersection{wxDataViewEvent::GetModel}\label{wxdatavieweventgetmodel}
|
||||||
|
|
||||||
\constfunc{wxDataViewModel*}{GetModel}{\void}
|
\constfunc{wxDataViewModel*}{GetModel}{\void}
|
||||||
|
|
||||||
|
Returns the wxDataViewModel associated with the event.
|
||||||
\membersection{wxDataViewEvent::GetRow}\label{wxdatavieweventgetrow}
|
|
||||||
|
|
||||||
\constfunc{int}{GetRow}{\void}
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::GetValue}\label{wxdatavieweventgetvalue}
|
\membersection{wxDataViewEvent::GetValue}\label{wxdatavieweventgetvalue}
|
||||||
|
|
||||||
\constfunc{const wxVariant\&}{GetValue}{\void}
|
\constfunc{const wxVariant\&}{GetValue}{\void}
|
||||||
|
|
||||||
|
Returns a reference to a value.
|
||||||
\membersection{wxDataViewEvent::IsEditCancelled}\label{wxdatavieweventiseditcancelled}
|
|
||||||
|
|
||||||
\constfunc{bool}{IsEditCancelled}{\void}
|
|
||||||
|
|
||||||
Was cell editing canceled? For wxEVT\_COMMAND\_DATAVIEW\_END\_CELL\_EDIT only.
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::SetColumn}\label{wxdatavieweventsetcolumn}
|
\membersection{wxDataViewEvent::SetColumn}\label{wxdatavieweventsetcolumn}
|
||||||
@@ -80,20 +80,11 @@ Was cell editing canceled? For wxEVT\_COMMAND\_DATAVIEW\_END\_CELL\_EDIT only.
|
|||||||
For wxEVT\_DATAVIEW\_COLUMN\_HEADER\_CLICKED only.
|
For wxEVT\_DATAVIEW\_COLUMN\_HEADER\_CLICKED only.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::SetEditCanceled}\label{wxdatavieweventseteditcanceled}
|
|
||||||
|
|
||||||
\func{void}{SetEditCanceled}{\param{bool }{editCancelled}}
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::SetModel}\label{wxdatavieweventsetmodel}
|
\membersection{wxDataViewEvent::SetModel}\label{wxdatavieweventsetmodel}
|
||||||
|
|
||||||
\func{void}{SetModel}{\param{wxDataViewModel* }{model}}
|
\func{void}{SetModel}{\param{wxDataViewModel* }{model}}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::SetRow}\label{wxdatavieweventsetrow}
|
|
||||||
|
|
||||||
\func{void}{SetRow}{\param{int }{row}}
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxDataViewEvent::SetValue}\label{wxdatavieweventsetvalue}
|
\membersection{wxDataViewEvent::SetValue}\label{wxdatavieweventsetvalue}
|
||||||
|
|
||||||
|
@@ -179,6 +179,9 @@ to the data.
|
|||||||
|
|
||||||
Call this to inform the model that an item has changed.
|
Call this to inform the model that an item has changed.
|
||||||
|
|
||||||
|
This will eventually emit a wxEVT\_DATAVIEW\_ITEM\_VALUE\_CHANGED
|
||||||
|
event (in which the column fields will not be set) to the user.
|
||||||
|
|
||||||
\membersection{wxDataViewModel::ItemsAdded}\label{wxdataviewmodelitemsadded}
|
\membersection{wxDataViewModel::ItemsAdded}\label{wxdataviewmodelitemsadded}
|
||||||
|
|
||||||
\func{virtual bool}{ItemsAdded}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
\func{virtual bool}{ItemsAdded}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
||||||
@@ -192,6 +195,9 @@ to the data.
|
|||||||
|
|
||||||
Call this to inform the model that several items have changed.
|
Call this to inform the model that several items have changed.
|
||||||
|
|
||||||
|
This will eventually emit wxEVT\_DATAVIEW\_ITEM\_VALUE\_CHANGED
|
||||||
|
events (in which the column fields will not be set) to the user.
|
||||||
|
|
||||||
\membersection{wxDataViewModel::ItemsDeleted}\label{wxdataviewmodelitemsdeleted}
|
\membersection{wxDataViewModel::ItemsDeleted}\label{wxdataviewmodelitemsdeleted}
|
||||||
|
|
||||||
\func{virtual bool}{ItemsDeleted}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
\func{virtual bool}{ItemsDeleted}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
||||||
@@ -225,6 +231,11 @@ has to be called!
|
|||||||
|
|
||||||
\func{virtual bool}{ValueChanged}{\param{const wxDataViewItem\& }{item}, \param{unsigned int }{col}}
|
\func{virtual bool}{ValueChanged}{\param{const wxDataViewItem\& }{item}, \param{unsigned int }{col}}
|
||||||
|
|
||||||
Call this to inform this model that a value in
|
Call this to inform this model that a value in the model has
|
||||||
the model has been changed.
|
been changed. This is also called from wxDataViewCtrl's
|
||||||
|
internal editing code, e.g. when editing a text field
|
||||||
|
in the control.
|
||||||
|
|
||||||
|
This will eventually emit a wxEVT\_DATAVIEW\_ITEM\_VALUE\_CHANGED
|
||||||
|
event to the user.
|
||||||
|
|
||||||
|
@@ -615,17 +615,11 @@ BEGIN_DECLARE_EVENT_TYPES()
|
|||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, -1)
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, -1)
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, -1)
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, -1)
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, -1)
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, -1)
|
||||||
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, -1)
|
||||||
|
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
|
||||||
|
|
||||||
// notifications from the model to the control
|
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED, -1)
|
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED, -1)
|
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED, -1)
|
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED, -1)
|
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED, -1)
|
|
||||||
END_DECLARE_EVENT_TYPES()
|
END_DECLARE_EVENT_TYPES()
|
||||||
|
|
||||||
typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
|
typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
|
||||||
@@ -645,18 +639,12 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
|
|||||||
#define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
|
#define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
|
||||||
#define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
|
#define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
|
||||||
#define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
|
#define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
|
||||||
|
#define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
|
||||||
|
|
||||||
#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
|
#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
|
||||||
#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
|
#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
|
||||||
#define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
|
#define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
|
||||||
|
|
||||||
#define EVT_DATAVIEW_MODEL_ITEM_ADDED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_ADDED, id, fn)
|
|
||||||
#define EVT_DATAVIEW_MODEL_ITEM_DELETED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_DELETED, id, fn)
|
|
||||||
#define EVT_DATAVIEW_MODEL_ITEM_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_CHANGED, id, fn)
|
|
||||||
#define EVT_DATAVIEW_MODEL_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_VALUE_CHANGED, id, fn)
|
|
||||||
#define EVT_DATAVIEW_MODEL_CLEARED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_CLEARED, id, fn)
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(wxUSE_GENERICDATAVIEWCTRL)
|
#if defined(wxUSE_GENERICDATAVIEWCTRL)
|
||||||
#include "wx/generic/dataview.h"
|
#include "wx/generic/dataview.h"
|
||||||
#elif defined(__WXGTK20__)
|
#elif defined(__WXGTK20__)
|
||||||
|
@@ -824,16 +824,11 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING)
|
|||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE)
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED)
|
||||||
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED)
|
||||||
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED)
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED)
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED)
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED)
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -416,7 +416,6 @@ public:
|
|||||||
virtual ~wxDataViewMainWindow();
|
virtual ~wxDataViewMainWindow();
|
||||||
|
|
||||||
// notifications from wxDataViewModel
|
// notifications from wxDataViewModel
|
||||||
void SendModelEvent( wxEventType type, const wxDataViewItem & item);
|
|
||||||
bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
|
bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
|
||||||
bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
|
bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
|
||||||
bool ItemChanged( const wxDataViewItem &item );
|
bool ItemChanged( const wxDataViewItem &item );
|
||||||
@@ -2013,25 +2012,12 @@ bool Walker( wxDataViewTreeNode * node, DoJob & func )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewMainWindow::SendModelEvent( wxEventType type, const wxDataViewItem & item )
|
|
||||||
{
|
|
||||||
wxWindow *parent = GetParent();
|
|
||||||
wxDataViewEvent le(type, parent->GetId());
|
|
||||||
|
|
||||||
le.SetEventObject(parent);
|
|
||||||
le.SetModel(GetOwner()->GetModel());
|
|
||||||
le.SetItem( item );
|
|
||||||
|
|
||||||
parent->GetEventHandler()->ProcessEvent(le);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxDataViewItem & item)
|
bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxDataViewItem & item)
|
||||||
{
|
{
|
||||||
SortPrepare();
|
SortPrepare();
|
||||||
|
|
||||||
wxDataViewTreeNode * node;
|
wxDataViewTreeNode * node;
|
||||||
node = FindNode(parent);
|
node = FindNode(parent);
|
||||||
SendModelEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED, item );
|
|
||||||
|
|
||||||
if( node == NULL )
|
if( node == NULL )
|
||||||
return false;
|
return false;
|
||||||
@@ -2118,8 +2104,6 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
|
|||||||
|
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
|
|
||||||
SendModelEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED, item);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2128,7 +2112,13 @@ bool wxDataViewMainWindow::ItemChanged(const wxDataViewItem & item)
|
|||||||
SortPrepare();
|
SortPrepare();
|
||||||
g_model->Resort();
|
g_model->Resort();
|
||||||
|
|
||||||
SendModelEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED,item);
|
//Send event
|
||||||
|
wxWindow *parent = GetParent();
|
||||||
|
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
|
||||||
|
le.SetEventObject(parent);
|
||||||
|
le.SetModel(GetOwner()->GetModel());
|
||||||
|
le.SetItem(item);
|
||||||
|
parent->GetEventHandler()->ProcessEvent(le);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2149,7 +2139,7 @@ bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned i
|
|||||||
|
|
||||||
//Send event
|
//Send event
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED, parent->GetId());
|
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
|
||||||
le.SetEventObject(parent);
|
le.SetEventObject(parent);
|
||||||
le.SetModel(GetOwner()->GetModel());
|
le.SetModel(GetOwner()->GetModel());
|
||||||
le.SetItem(item);
|
le.SetItem(item);
|
||||||
@@ -2167,12 +2157,6 @@ bool wxDataViewMainWindow::Cleared()
|
|||||||
DestroyTree();
|
DestroyTree();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
|
|
||||||
wxWindow *parent = GetParent();
|
|
||||||
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED, parent->GetId());
|
|
||||||
le.SetEventObject(parent);
|
|
||||||
le.SetModel(GetOwner()->GetModel());
|
|
||||||
parent->GetEventHandler()->ProcessEvent(le);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2436,12 +2436,6 @@ bool wxDataViewCtrlInternal::ItemAdded( const wxDataViewItem &parent, const wxDa
|
|||||||
else
|
else
|
||||||
parent_node->AddLeave( item.GetID() );
|
parent_node->AddLeave( item.GetID() );
|
||||||
|
|
||||||
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED, m_owner->GetId() );
|
|
||||||
event.SetEventObject( m_owner );
|
|
||||||
event.SetModel( m_owner->GetModel() );
|
|
||||||
event.SetItem( item );
|
|
||||||
m_owner->GetEventHandler()->ProcessEvent( event );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2450,18 +2444,12 @@ bool wxDataViewCtrlInternal::ItemDeleted( const wxDataViewItem &parent, const wx
|
|||||||
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
wxGtkTreeModelNode *parent_node = FindNode( parent );
|
||||||
parent_node->DeleteChild( item.GetID() );
|
parent_node->DeleteChild( item.GetID() );
|
||||||
|
|
||||||
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED, m_owner->GetId() );
|
|
||||||
event.SetEventObject( m_owner );
|
|
||||||
event.SetModel( m_owner->GetModel() );
|
|
||||||
event.SetItem( item );
|
|
||||||
m_owner->GetEventHandler()->ProcessEvent( event );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDataViewCtrlInternal::ItemChanged( const wxDataViewItem &item )
|
bool wxDataViewCtrlInternal::ItemChanged( const wxDataViewItem &item )
|
||||||
{
|
{
|
||||||
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED, m_owner->GetId() );
|
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, m_owner->GetId() );
|
||||||
event.SetEventObject( m_owner );
|
event.SetEventObject( m_owner );
|
||||||
event.SetModel( m_owner->GetModel() );
|
event.SetModel( m_owner->GetModel() );
|
||||||
event.SetItem( item );
|
event.SetItem( item );
|
||||||
@@ -2472,10 +2460,11 @@ bool wxDataViewCtrlInternal::ItemChanged( const wxDataViewItem &item )
|
|||||||
|
|
||||||
bool wxDataViewCtrlInternal::ValueChanged( const wxDataViewItem &item, unsigned int col )
|
bool wxDataViewCtrlInternal::ValueChanged( const wxDataViewItem &item, unsigned int col )
|
||||||
{
|
{
|
||||||
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED, m_owner->GetId() );
|
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, m_owner->GetId() );
|
||||||
event.SetEventObject( m_owner );
|
event.SetEventObject( m_owner );
|
||||||
event.SetModel( m_owner->GetModel() );
|
event.SetModel( m_owner->GetModel() );
|
||||||
event.SetColumn( col );
|
event.SetColumn( col );
|
||||||
|
event.SetDataViewColumn( GetOwner()->GetColumn(col) );
|
||||||
event.SetItem( item );
|
event.SetItem( item );
|
||||||
m_owner->GetEventHandler()->ProcessEvent( event );
|
m_owner->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
@@ -2484,11 +2473,6 @@ bool wxDataViewCtrlInternal::ValueChanged( const wxDataViewItem &item, unsigned
|
|||||||
|
|
||||||
bool wxDataViewCtrlInternal::Cleared()
|
bool wxDataViewCtrlInternal::Cleared()
|
||||||
{
|
{
|
||||||
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED, m_owner->GetId() );
|
|
||||||
event.SetEventObject( m_owner );
|
|
||||||
event.SetModel( m_owner->GetModel() );
|
|
||||||
m_owner->GetEventHandler()->ProcessEvent( event );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2932,6 +2916,52 @@ void gtk_dataviewctrl_size_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "motion_notify_event"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_dataview_motion_notify_callback( GtkWidget *widget,
|
||||||
|
GdkEventMotion *gdk_event,
|
||||||
|
wxDataViewCtrl *dv )
|
||||||
|
{
|
||||||
|
if (gdk_event->is_hint)
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
GdkModifierType state;
|
||||||
|
gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
|
||||||
|
gdk_event->x = x;
|
||||||
|
gdk_event->y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkTreePath *path = NULL;
|
||||||
|
GtkTreeViewColumn *column = NULL;
|
||||||
|
gint cell_x = 0;
|
||||||
|
gint cell_y = 0;
|
||||||
|
if (gtk_tree_view_get_path_at_pos(
|
||||||
|
GTK_TREE_VIEW(dv->GtkGetTreeView()),
|
||||||
|
(int) gdk_event->x, (int) gdk_event->y,
|
||||||
|
&path,
|
||||||
|
&column,
|
||||||
|
&cell_x,
|
||||||
|
&cell_y))
|
||||||
|
{
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
GtkTreeIter iter;
|
||||||
|
dv->GtkGetInternal()->get_iter( &iter, path );
|
||||||
|
|
||||||
|
// wxPrintf( "mouse %d %d\n", (int) gdk_event->x, (int) gdk_event->y );
|
||||||
|
|
||||||
|
gtk_tree_path_free( path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase)
|
IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase)
|
||||||
|
|
||||||
@@ -3036,6 +3066,9 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
g_signal_connect_after (m_treeview, "row-expanded",
|
g_signal_connect_after (m_treeview, "row-expanded",
|
||||||
G_CALLBACK (wxdataview_row_expanded_callback), this);
|
G_CALLBACK (wxdataview_row_expanded_callback), this);
|
||||||
|
|
||||||
|
g_signal_connect (m_treeview, "motion_notify_event",
|
||||||
|
G_CALLBACK (gtk_dataview_motion_notify_callback), this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -131,7 +131,7 @@ public:
|
|||||||
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
|
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
|
||||||
|
|
||||||
// sent the equivalent wxWidget event:
|
// sent the equivalent wxWidget event:
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_VALUE_ITEM_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
|
||||||
|
|
||||||
dataViewEvent.SetEventObject(dataViewCtrlPtr);
|
dataViewEvent.SetEventObject(dataViewCtrlPtr);
|
||||||
dataViewEvent.SetItem(item);
|
dataViewEvent.SetItem(item);
|
||||||
@@ -183,7 +183,7 @@ public:
|
|||||||
(this->m_dataViewControlPtr->UpdateItems(parentID,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
|
(this->m_dataViewControlPtr->UpdateItems(parentID,1,&itemID,dataViewCtrlPtr->GetColumn(col)->GetPropertyID(),propertyID) == noErr))
|
||||||
{
|
{
|
||||||
// variable definition and initialization:
|
// variable definition and initialization:
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED,dataViewCtrlPtr->GetId());
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId());
|
||||||
|
|
||||||
dataViewEvent.SetEventObject(dataViewCtrlPtr);
|
dataViewEvent.SetEventObject(dataViewCtrlPtr);
|
||||||
dataViewEvent.SetColumn(col);
|
dataViewEvent.SetColumn(col);
|
||||||
@@ -200,17 +200,7 @@ public:
|
|||||||
virtual bool Cleared(void)
|
virtual bool Cleared(void)
|
||||||
{
|
{
|
||||||
if (this->m_dataViewControlPtr->RemoveItems() == noErr)
|
if (this->m_dataViewControlPtr->RemoveItems() == noErr)
|
||||||
{
|
|
||||||
// variable definitions and initializations:
|
|
||||||
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
|
|
||||||
wxDataViewEvent dataViewEvent (wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED,dataViewCtrlPtr->GetId());
|
|
||||||
|
|
||||||
dataViewEvent.SetEventObject(dataViewCtrlPtr);
|
|
||||||
// send the equivalent wxWidget event:
|
|
||||||
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
|
|
||||||
// done
|
|
||||||
return true;
|
return true;
|
||||||
} /* if */
|
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
} /* Cleared(void) */
|
} /* Cleared(void) */
|
||||||
|
Reference in New Issue
Block a user