void wxItemContainer::Delete(unsigned int pos)
{
- wxCHECK_RET( pos < GetCount(), _T("invalid index") );
+ wxCHECK_RET( pos < GetCount(), wxT("invalid index") );
if ( HasClientObjectData() )
ResetItemClientObject(pos);
}
// ----------------------------------------------------------------------------
-//
+//
// ----------------------------------------------------------------------------
int wxItemContainer::DoInsertItemsInLoop(const wxArrayStringsAdapter& items,
wxItemContainer::DoInsertOneItem(const wxString& WXUNUSED(item),
unsigned int WXUNUSED(pos))
{
- wxFAIL_MSG( _T("Must be overridden if DoInsertItemsInLoop() is used") );
+ wxFAIL_MSG( wxT("Must be overridden if DoInsertItemsInLoop() is used") );
return wxNOT_FOUND;
}
if ( HasClientObjectData() )
{
wxClientData * clientDataOld
- = wx_static_cast(wxClientData *, DoGetItemClientData(n));
+ = static_cast<wxClientData *>(DoGetItemClientData(n));
if ( clientDataOld )
delete clientDataOld;
}
wxCHECK_MSG( HasClientObjectData(), NULL,
wxT("this window doesn't have object client data") );
- return wx_static_cast(wxClientData *, DoGetItemClientData(n));
+ 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)
SetClientObject
(
pos,
- (wx_reinterpret_cast(wxClientData **, clientData))[n]
+ (reinterpret_cast<wxClientData **>(clientData))[n]
);
break;
break;
default:
- wxFAIL_MSG( _T("unknown client data type") );
+ wxFAIL_MSG( wxT("unknown client data type") );
// fall through
case wxClientData_None: