Added API for adding/deleting/changing multiple items
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -179,11 +179,24 @@ 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.
|
||||||
|
|
||||||
\membersection{wxDataViewModel::ItemDeleted}\label{wxdataviewmodelitemdeleted}
|
\membersection{wxDataViewModel::ItemsAdded}\label{wxdataviewmodelitemsadded}
|
||||||
|
|
||||||
\func{virtual bool}{ItemDeleted}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItem\& }{item}}
|
\func{virtual bool}{ItemsAdded}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
||||||
|
|
||||||
Call this to inform the model that an item has been deleted.
|
Call this to inform the model that several items have been added
|
||||||
|
to the data.
|
||||||
|
|
||||||
|
\membersection{wxDataViewModel::ItemsChanged}\label{wxdataviewmodelitemschanged}
|
||||||
|
|
||||||
|
\func{virtual bool}{ItemsChanged}{\param{const wxDataViewItemArray\& }{items}}
|
||||||
|
|
||||||
|
Call this to inform the model that several items have changed.
|
||||||
|
|
||||||
|
\membersection{wxDataViewModel::ItemsDeleted}\label{wxdataviewmodelitemsdeleted}
|
||||||
|
|
||||||
|
\func{virtual bool}{ItemsDeleted}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
||||||
|
|
||||||
|
Call this to inform the model that several items have been deleted.
|
||||||
|
|
||||||
\membersection{wxDataViewModel::RemoveNotifier}\label{wxdataviewmodelremovenotifier}
|
\membersection{wxDataViewModel::RemoveNotifier}\label{wxdataviewmodelremovenotifier}
|
||||||
|
|
||||||
|
@@ -61,6 +61,24 @@ Called by owning model.
|
|||||||
|
|
||||||
Called by owning model.
|
Called by owning model.
|
||||||
|
|
||||||
|
\membersection{wxDataViewModelNotifier::ItemsAdded}\label{wxdataviewmodelnotifieritemsadded}
|
||||||
|
|
||||||
|
\func{bool}{ItemsAdded}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
||||||
|
|
||||||
|
Called by owning model.
|
||||||
|
|
||||||
|
\membersection{wxDataViewModelNotifier::ItemsChanged}\label{wxdataviewmodelnotifieritemschanged}
|
||||||
|
|
||||||
|
\func{bool}{ItemsChanged}{\param{const wxDataViewItemArray\& }{items}}
|
||||||
|
|
||||||
|
Called by owning model.
|
||||||
|
|
||||||
|
\membersection{wxDataViewModelNotifier::ItemsDeleted}\label{wxdataviewmodelnotifieritemsdeleted}
|
||||||
|
|
||||||
|
\func{bool}{ItemsDeleted}{\param{const wxDataViewItem\& }{parent}, \param{const wxDataViewItemArray\& }{items}}
|
||||||
|
|
||||||
|
Called by owning model.
|
||||||
|
|
||||||
\membersection{wxDataViewModelNotifier::Resort}\label{wxdataviewmodelnotifierresort}
|
\membersection{wxDataViewModelNotifier::Resort}\label{wxdataviewmodelnotifierresort}
|
||||||
|
|
||||||
\func{void}{Resort}{\void}
|
\func{void}{Resort}{\void}
|
||||||
|
@@ -98,6 +98,9 @@ public:
|
|||||||
virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
|
virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
|
||||||
virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
|
virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
|
||||||
virtual bool ItemChanged( const wxDataViewItem &item ) = 0;
|
virtual bool ItemChanged( const wxDataViewItem &item ) = 0;
|
||||||
|
virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items );
|
||||||
|
virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
|
||||||
|
virtual bool ItemsChanged( const wxDataViewItemArray &items );
|
||||||
virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0;
|
virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0;
|
||||||
virtual bool Cleared() = 0;
|
virtual bool Cleared() = 0;
|
||||||
|
|
||||||
@@ -142,8 +145,11 @@ public:
|
|||||||
|
|
||||||
// delegated notifiers
|
// delegated notifiers
|
||||||
virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
|
virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
|
||||||
|
virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items );
|
||||||
virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
|
virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
|
||||||
|
virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
|
||||||
virtual bool ItemChanged( const wxDataViewItem &item );
|
virtual bool ItemChanged( const wxDataViewItem &item );
|
||||||
|
virtual bool ItemsChanged( const wxDataViewItemArray &items );
|
||||||
virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col );
|
virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col );
|
||||||
virtual bool Cleared();
|
virtual bool Cleared();
|
||||||
|
|
||||||
|
@@ -33,12 +33,46 @@ bool operator == (const wxDataViewItem &left, const wxDataViewItem &right)
|
|||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewModel
|
// wxDataViewModelNotifier
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
#include "wx/listimpl.cpp"
|
#include "wx/listimpl.cpp"
|
||||||
WX_DEFINE_LIST(wxDataViewModelNotifiers);
|
WX_DEFINE_LIST(wxDataViewModelNotifiers);
|
||||||
|
|
||||||
|
bool wxDataViewModelNotifier::ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items )
|
||||||
|
{
|
||||||
|
size_t count = items.GetCount();
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (!ItemAdded( parent, items[i] )) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataViewModelNotifier::ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items )
|
||||||
|
{
|
||||||
|
size_t count = items.GetCount();
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (!ItemDeleted( parent, items[i] )) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataViewModelNotifier::ItemsChanged( const wxDataViewItemArray &items )
|
||||||
|
{
|
||||||
|
size_t count = items.GetCount();
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (!ItemChanged( items[i] )) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// wxDataViewModel
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
wxDataViewModel::wxDataViewModel()
|
wxDataViewModel::wxDataViewModel()
|
||||||
{
|
{
|
||||||
m_notifiers.DeleteContents( true );
|
m_notifiers.DeleteContents( true );
|
||||||
@@ -89,6 +123,51 @@ bool wxDataViewModel::ItemChanged( const wxDataViewItem &item )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxDataViewModel::ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items )
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
|
wxDataViewModelNotifiers::iterator iter;
|
||||||
|
for (iter = m_notifiers.begin(); iter != m_notifiers.end(); ++iter)
|
||||||
|
{
|
||||||
|
wxDataViewModelNotifier* notifier = *iter;
|
||||||
|
if (!notifier->ItemsAdded( parent, items ))
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataViewModel::ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items )
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
|
wxDataViewModelNotifiers::iterator iter;
|
||||||
|
for (iter = m_notifiers.begin(); iter != m_notifiers.end(); ++iter)
|
||||||
|
{
|
||||||
|
wxDataViewModelNotifier* notifier = *iter;
|
||||||
|
if (!notifier->ItemsDeleted( parent, items ))
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataViewModel::ItemsChanged( const wxDataViewItemArray &items )
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
|
wxDataViewModelNotifiers::iterator iter;
|
||||||
|
for (iter = m_notifiers.begin(); iter != m_notifiers.end(); ++iter)
|
||||||
|
{
|
||||||
|
wxDataViewModelNotifier* notifier = *iter;
|
||||||
|
if (!notifier->ItemsChanged( items ))
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxDataViewModel::ValueChanged( const wxDataViewItem &item, unsigned int col )
|
bool wxDataViewModel::ValueChanged( const wxDataViewItem &item, unsigned int col )
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
Reference in New Issue
Block a user