Add wxItemContainer::DetachClientObject() and use it in wxRearrangeList.

Add a method to detach the item from an item control without deleting it and
use it in wxRearrangeList to correctly swap object client data without
deleting the pointers in the process.

Closes #12201.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-07-22 12:09:15 +00:00
parent 9b481f66e5
commit ab9893576c
4 changed files with 52 additions and 6 deletions

View File

@@ -191,6 +191,18 @@ wxClientData *wxItemContainer::GetClientObject(unsigned int n) const
return static_cast<wxClientData *>(DoGetItemClientData(n));
}
wxClientData *wxItemContainer::DetachClientObject(unsigned int n)
{
wxClientData * const data = GetClientObject(n);
if ( data )
{
// reset the pointer as we don't own it any more
DoSetItemClientData(n, NULL);
}
return data;
}
void wxItemContainer::SetClientData(unsigned int n, void *data)
{
if ( !HasClientData() )