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

@@ -1653,7 +1653,7 @@ struct WXDLLEXPORT wxEventTable
// wxEvtHandler: the base class for all objects handling wxWindows events
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxEvtHandler : public wxObject, public wxClientDataContainer
class WXDLLEXPORT wxEvtHandler : public wxObject
{
public:
wxEvtHandler();
@@ -1703,6 +1703,15 @@ public:
wxObject *userData = (wxObject *) NULL )
{ return Disconnect(id, -1, eventType, func, userData); }
// User data can be associated with each wxEvtHandler
void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
wxClientData *GetClientObject() const { return DoGetClientObject(); }
void SetClientData( void *data ) { DoSetClientData(data); }
void *GetClientData() const { return DoGetClientData(); }
// implementation from now on
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
bool SearchDynamicEventTable( wxEvent& event );
@@ -1763,6 +1772,29 @@ protected:
// Is event handler enabled?
bool m_enabled;
// The user data: either an object which will be deleted by the container
// when it's deleted or some raw pointer which we do nothing with - only
// one type of data can be used with the given window (i.e. you cannot set
// the void data and then associate the container with wxClientData or vice
// versa)
union
{
wxClientData *m_clientObject;
void *m_clientData;
};
// what kind of data do we have?
wxClientDataType m_clientDataType;
// client data accessors
virtual void DoSetClientObject( wxClientData *data );
virtual wxClientData *DoGetClientObject() const;
virtual void DoSetClientData( void *data );
virtual void *DoGetClientData() const;
private:
DECLARE_DYNAMIC_CLASS(wxEvtHandler)
};