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}
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}
\func{void}{Resort}{\void}
virtual bool ItemAdded( 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 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 Cleared() = 0;
// delegated notifiers
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 ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
virtual bool ItemChanged( const wxDataViewItem &item );
+ virtual bool ItemsChanged( const wxDataViewItemArray &items );
virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col );
virtual bool Cleared();
// ---------------------------------------------------------
-// wxDataViewModel
+// wxDataViewModelNotifier
// ---------------------------------------------------------
#include "wx/listimpl.cpp"
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()
{
m_notifiers.DeleteContents( true );
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 ret = true;