X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/131b1fba9dbedc86a0b5d7861ca374800f3ad40d..2e49a8074e7c9179b642852ff00ed8fdf0768bb1:/src/common/ctrlsub.cpp diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index 05440cd78f..68d4b1a591 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -109,7 +109,7 @@ void wxItemContainer::Clear() void wxItemContainer::Delete(unsigned int pos) { - wxCHECK_RET( pos < GetCount(), _T("invalid index") ); + wxCHECK_RET( pos < GetCount(), wxT("invalid index") ); if ( HasClientObjectData() ) ResetItemClientObject(pos); @@ -123,7 +123,7 @@ void wxItemContainer::Delete(unsigned int pos) } // ---------------------------------------------------------------------------- -// +// // ---------------------------------------------------------------------------- int wxItemContainer::DoInsertItemsInLoop(const wxArrayStringsAdapter& items, @@ -150,7 +150,7 @@ int 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; } @@ -168,7 +168,7 @@ void wxItemContainer::SetClientObject(unsigned int n, wxClientData *data) if ( HasClientObjectData() ) { wxClientData * clientDataOld - = wx_static_cast(wxClientData *, DoGetItemClientData(n)); + = static_cast(DoGetItemClientData(n)); if ( clientDataOld ) delete clientDataOld; } @@ -188,7 +188,19 @@ wxClientData *wxItemContainer::GetClientObject(unsigned int n) const wxCHECK_MSG( HasClientObjectData(), NULL, wxT("this window doesn't have object client data") ); - return wx_static_cast(wxClientData *, DoGetItemClientData(n)); + return static_cast(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) @@ -224,7 +236,7 @@ void wxItemContainer::AssignNewItemClientData(unsigned int pos, SetClientObject ( pos, - (wx_reinterpret_cast(wxClientData **, clientData))[n] + (reinterpret_cast(clientData))[n] ); break; @@ -233,7 +245,7 @@ void wxItemContainer::AssignNewItemClientData(unsigned int pos, break; default: - wxFAIL_MSG( _T("unknown client data type") ); + wxFAIL_MSG( wxT("unknown client data type") ); // fall through case wxClientData_None: