Moved client data stuff directly into wxEvtHandler, #if'd out

wxClientDataContainer for now.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-10-12 03:18:35 +00:00
parent a6ee08e16a
commit b88c44e735
4 changed files with 87 additions and 6 deletions

View File

@@ -761,6 +761,9 @@ wxEvtHandler::wxEvtHandler()
m_eventsLocker = new wxCriticalSection;
# endif
#endif
// no client data (yet)
m_clientData = NULL;
m_clientDataType = wxClientData_None;
}
wxEvtHandler::~wxEvtHandler()
@@ -798,6 +801,10 @@ wxEvtHandler::~wxEvtHandler()
delete m_eventsLocker;
# endif
#endif
// we only delete object data, not untyped
if ( m_clientDataType == wxClientData_Object )
delete m_clientObject;
}
#if wxUSE_THREADS
@@ -1171,6 +1178,48 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
return FALSE;
};
void wxEvtHandler::DoSetClientObject( wxClientData *data )
{
wxASSERT_MSG( m_clientDataType != wxClientData_Void,
wxT("can't have both object and void client data") );
if ( m_clientObject )
delete m_clientObject;
m_clientObject = data;
m_clientDataType = wxClientData_Object;
}
wxClientData *wxEvtHandler::DoGetClientObject() const
{
// it's not an error to call GetClientObject() on a window which doesn't
// have client data at all - NULL will be returned
wxASSERT_MSG( m_clientDataType != wxClientData_Void,
wxT("this window doesn't have object client data") );
return m_clientObject;
}
void wxEvtHandler::DoSetClientData( void *data )
{
wxASSERT_MSG( m_clientDataType != wxClientData_Object,
wxT("can't have both object and void client data") );
m_clientData = data;
m_clientDataType = wxClientData_Void;
}
void *wxEvtHandler::DoGetClientData() const
{
// it's not an error to call GetClientData() on a window which doesn't have
// client data at all - NULL will be returned
wxASSERT_MSG( m_clientDataType != wxClientData_Object,
wxT("this window doesn't have void client data") );
return m_clientData;
}
#if WXWIN_COMPATIBILITY
bool wxEvtHandler::OnClose()
{