Add compare function to wxDataViewModel

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47258 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-07-09 12:32:59 +00:00
parent aba9bfd00a
commit 5732efaa91
2 changed files with 10 additions and 2 deletions

View File

@@ -83,12 +83,15 @@ private:
wxUint32 m_id; wxUint32 m_id;
}; };
bool operator == ( const wxDataViewItem & left, const wxDataViewItem & right ); bool operator == ( const wxDataViewItem& left, const wxDataViewItem& right );
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewModel // wxDataViewModel
// --------------------------------------------------------- // ---------------------------------------------------------
typedef int (wxCALLBACK *wxDataViewModelCompare)
(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int col, unsigned int option );
class WXDLLIMPEXP_ADV wxDataViewModel: public wxObjectRefData class WXDLLIMPEXP_ADV wxDataViewModel: public wxObjectRefData
{ {
public: public:
@@ -125,11 +128,15 @@ public:
void AddNotifier( wxDataViewModelNotifier *notifier ); void AddNotifier( wxDataViewModelNotifier *notifier );
void RemoveNotifier( wxDataViewModelNotifier *notifier ); void RemoveNotifier( wxDataViewModelNotifier *notifier );
void SetCompareFunction( wxDataViewModelCompare func ) { m_cmpFunc = func; }
wxDataViewModelCompare GetCompareFunction() { return m_cmpFunc; }
protected: protected:
// the user should not delete this class directly: he should use DecRef() instead! // the user should not delete this class directly: he should use DecRef() instead!
virtual ~wxDataViewModel() { } virtual ~wxDataViewModel() { }
wxList m_notifiers; wxList m_notifiers;
wxDataViewModelCompare m_cmpFunc;
}; };
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@@ -33,6 +33,7 @@ const wxChar wxDataViewCtrlNameStr[] = wxT("dataviewCtrl");
wxDataViewModel::wxDataViewModel() wxDataViewModel::wxDataViewModel()
{ {
m_notifiers.DeleteContents( true ); m_notifiers.DeleteContents( true );
m_cmpFunc = NULL;
} }
bool wxDataViewModel::ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) bool wxDataViewModel::ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item )