1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: A mixin class for holding a wxClientData or void pointer
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CLNTDATAH__
13 #define _WX_CLNTDATAH__
16 #pragma interface "event.h"
21 // ----------------------------------------------------------------------------
23 // what kind of client data do we have?
26 wxClientData_None
, // we don't know yet because we don't have it at all
27 wxClientData_Object
, // our client data is typed and we own it
28 wxClientData_Void
// client data is untyped and we don't own it
31 class WXDLLEXPORT wxClientData
35 virtual ~wxClientData() { }
38 class WXDLLEXPORT wxStringClientData
: public wxClientData
41 wxStringClientData() { }
42 wxStringClientData( const wxString
&data
) : m_data(data
) { }
43 void SetData( const wxString
&data
) { m_data
= data
; }
44 const wxString
& GetData() const { return m_data
; }
51 class WXDLLEXPORT wxClientDataContainer
54 wxClientDataContainer();
55 ~wxClientDataContainer();
57 // each window may have associated client data: either a pointer to
58 // wxClientData object in which case it is managed by the window (i.e.
59 // it will delete the data when it's destroyed) or an untyped pointer
60 // which won't be deleted by the window - but not both of them
61 void SetClientObject( wxClientData
*data
) { DoSetClientObject(data
); }
62 wxClientData
*GetClientObject() const { return DoGetClientObject(); }
64 void SetClientData( void *data
) { DoSetClientData(data
); }
65 void *GetClientData() const { return DoGetClientData(); }
68 // user data associated with the window: either an object which will be
69 // deleted by the window when it's deleted or some raw pointer which we do
70 // nothing with - only one type of data can be used with the given window
71 // (i.e. you cannot set the void data and then associate the window with
72 // wxClientData or vice versa)
75 wxClientData
*m_clientObject
;
79 // client data accessors
80 virtual void DoSetClientObject( wxClientData
*data
);
81 virtual wxClientData
*DoGetClientObject() const;
83 virtual void DoSetClientData( void *data
);
84 virtual void *DoGetClientData() const;
86 // what kind of data do we have?
87 wxClientDataType m_clientDataType
;
91 // ----------------------------------------------------------------------------