]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/clntdata.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxClientData[Container] and wxStringClientData
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 @class wxClientDataContainer
11 This class is a mixin that provides storage and management of "client data".
12 This data can either be of type void - in which case the data
13 @e container does not take care of freeing the data again or it is of
14 type wxClientData or its derivatives. In that case the container will free
15 the memory itself later. Note that you @e must not assign both void data
16 and data derived from the wxClientData class to a container.
18 @note This functionality is currently duplicated in wxEvtHandler in order
19 to avoid having more than one vtable in that class hierarchy.
24 @see wxEvtHandler, wxClientData
26 class wxClientDataContainer
32 wxClientDataContainer();
37 virtual ~wxClientDataContainer();
40 Get the untyped client data.
42 void* GetClientData() const;
45 Get a pointer to the client data object.
47 wxClientData
* GetClientObject() const;
50 Set the untyped client data.
52 void SetClientData(void* data
);
55 Set the client data object. Any previous object will be deleted.
57 void SetClientObject(wxClientData
* data
);
65 All classes deriving from wxEvtHandler (such as all controls and wxApp) can
66 hold arbitrary data which is here referred to as "client data". This is
67 useful e.g. for scripting languages which need to handle shadow objects for
68 most of wxWidgets' classes and which store a handle to such a shadow class
69 as client data in that class. This data can either be of type void - in
70 which case the data @e container does not take care of freeing the data
71 again or it is of type wxClientData or its derivatives. In that case the
72 container (e.g. a control) will free the memory itself later. Note that you
73 @e must not assign both void data and data derived from the wxClientData
76 Some controls can hold various items and these controls can additionally
77 hold client data for each item. This is the case for wxChoice, wxComboBox
78 and wxListBox. wxTreeCtrl has a specialized class wxTreeItemData for each
81 If you want to add client data to your own classes, you may use the mix-in
82 class wxClientDataContainer.
87 @see wxEvtHandler, wxTreeItemData, wxStringClientData,
101 virtual ~wxClientData();
107 @class wxStringClientData
109 Predefined client data class for holding a string.
112 @category{containers}
114 class wxStringClientData
: public wxClientData
120 wxStringClientData();
123 Create client data with string.
125 wxStringClientData(const wxString
& data
);
128 Get string client data.
130 const wxString
& GetData() const;
133 Set string client data.
135 void SetData(const wxString
& data
);