Use child's listmodelnotifier's destructor (by overloading
it) to get informed about the destruction of the child model in a sorted model. Removed Freed() method used for that so far. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,7 @@ class WXDLLIMPEXP_ADV wxDataViewListModelNotifier: public wxObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDataViewListModelNotifier() { }
|
wxDataViewListModelNotifier() { }
|
||||||
virtual ~wxDataViewListModelNotifier() { }
|
virtual ~wxDataViewListModelNotifier() { m_owner = NULL; }
|
||||||
|
|
||||||
virtual bool RowAppended() = 0;
|
virtual bool RowAppended() = 0;
|
||||||
virtual bool RowPrepended() = 0;
|
virtual bool RowPrepended() = 0;
|
||||||
@@ -92,8 +92,6 @@ public:
|
|||||||
virtual bool ValueChanged( unsigned int col, unsigned int row ) = 0;
|
virtual bool ValueChanged( unsigned int col, unsigned int row ) = 0;
|
||||||
virtual bool RowsReordered( unsigned int *new_order ) = 0;
|
virtual bool RowsReordered( unsigned int *new_order ) = 0;
|
||||||
virtual bool Cleared() = 0;
|
virtual bool Cleared() = 0;
|
||||||
virtual bool Freed()
|
|
||||||
{ m_owner = NULL; return true; }
|
|
||||||
|
|
||||||
void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; }
|
void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; }
|
||||||
wxDataViewListModel *GetOwner() { return m_owner; }
|
wxDataViewListModel *GetOwner() { return m_owner; }
|
||||||
@@ -224,6 +222,8 @@ public:
|
|||||||
|
|
||||||
virtual void Resort();
|
virtual void Resort();
|
||||||
|
|
||||||
|
void DetachChild();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_ascending;
|
bool m_ascending;
|
||||||
wxDataViewListModel *m_child;
|
wxDataViewListModel *m_child;
|
||||||
|
@@ -38,13 +38,6 @@ wxDataViewListModel::wxDataViewListModel()
|
|||||||
|
|
||||||
wxDataViewListModel::~wxDataViewListModel()
|
wxDataViewListModel::~wxDataViewListModel()
|
||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = m_notifiers.GetFirst();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxDataViewListModelNotifier* notifier = (wxDataViewListModelNotifier*) node->GetData();
|
|
||||||
notifier->Freed();
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDataViewListModel::RowAppended()
|
bool wxDataViewListModel::RowAppended()
|
||||||
@@ -218,6 +211,9 @@ public:
|
|||||||
wxDataViewSortedListModelNotifier( wxDataViewSortedListModel *model )
|
wxDataViewSortedListModelNotifier( wxDataViewSortedListModel *model )
|
||||||
{ m_model = model; }
|
{ m_model = model; }
|
||||||
|
|
||||||
|
~wxDataViewSortedListModelNotifier()
|
||||||
|
{ m_model->DetachChild(); }
|
||||||
|
|
||||||
virtual bool RowAppended()
|
virtual bool RowAppended()
|
||||||
{ return m_model->ChildRowAppended(); }
|
{ return m_model->ChildRowAppended(); }
|
||||||
|
|
||||||
@@ -242,9 +238,6 @@ public:
|
|||||||
virtual bool Cleared()
|
virtual bool Cleared()
|
||||||
{ return m_model->ChildCleared(); }
|
{ return m_model->ChildCleared(); }
|
||||||
|
|
||||||
virtual bool Freed()
|
|
||||||
{ m_model->m_child = NULL; return wxDataViewListModelNotifier::Freed(); }
|
|
||||||
|
|
||||||
wxDataViewSortedListModel *m_model;
|
wxDataViewSortedListModel *m_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -328,6 +321,11 @@ wxDataViewSortedListModel::~wxDataViewSortedListModel()
|
|||||||
m_child->RemoveNotifier( m_notifierOnChild );
|
m_child->RemoveNotifier( m_notifierOnChild );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDataViewSortedListModel::DetachChild()
|
||||||
|
{
|
||||||
|
m_child = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
void wxDataViewSortedListModel::InitStatics()
|
void wxDataViewSortedListModel::InitStatics()
|
||||||
{
|
{
|
||||||
|
@@ -778,6 +778,7 @@ class wxGtkDataViewListModelNotifier: public wxDataViewListModelNotifier
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store, wxDataViewListModel *wx_model );
|
wxGtkDataViewListModelNotifier( GtkWxListStore* gtk_store, wxDataViewListModel *wx_model );
|
||||||
|
~wxGtkDataViewListModelNotifier();
|
||||||
|
|
||||||
virtual bool RowAppended();
|
virtual bool RowAppended();
|
||||||
virtual bool RowPrepended();
|
virtual bool RowPrepended();
|
||||||
@@ -788,13 +789,6 @@ public:
|
|||||||
virtual bool RowsReordered( unsigned int *new_order );
|
virtual bool RowsReordered( unsigned int *new_order );
|
||||||
virtual bool Cleared();
|
virtual bool Cleared();
|
||||||
|
|
||||||
virtual bool Freed()
|
|
||||||
{
|
|
||||||
m_wx_model = NULL;
|
|
||||||
m_gtk_store = NULL;
|
|
||||||
return wxDataViewListModelNotifier::Freed();
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWxListStore *m_gtk_store;
|
GtkWxListStore *m_gtk_store;
|
||||||
wxDataViewListModel *m_wx_model;
|
wxDataViewListModel *m_wx_model;
|
||||||
};
|
};
|
||||||
@@ -810,6 +804,12 @@ wxGtkDataViewListModelNotifier::wxGtkDataViewListModelNotifier(
|
|||||||
m_wx_model = wx_model;
|
m_wx_model = wx_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxGtkDataViewListModelNotifier::~wxGtkDataViewListModelNotifier()
|
||||||
|
{
|
||||||
|
m_wx_model = NULL;
|
||||||
|
m_gtk_store = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxGtkDataViewListModelNotifier::RowAppended()
|
bool wxGtkDataViewListModelNotifier::RowAppended()
|
||||||
{
|
{
|
||||||
unsigned int pos = m_wx_model->GetRowCount()-1;
|
unsigned int pos = m_wx_model->GetRowCount()-1;
|
||||||
|
Reference in New Issue
Block a user