]>
git.saurik.com Git - wxWidgets.git/blob - interface/clntdata.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxClientDataContainer
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxClientDataContainer
13 This class is a mixin that provides storage and management of "client
14 data." This data can either be of type void - in which case the data
15 @e container does not take care of freeing the data again
16 or it is of type wxClientData or its derivatives. In that case the
17 container will free the memory itself later.
18 Note that you @e must not assign both void data and data
19 derived from the wxClientData class to a container.
21 NOTE: This functionality is currently duplicated in wxEvtHandler in
22 order to avoid having more than one vtable in that class hierarchy.
27 @see wxEvtHandler, wxClientData
29 class wxClientDataContainer
35 wxClientDataContainer();
40 ~wxClientDataContainer();
43 Get the untyped client data.
45 void* GetClientData() const;
48 Get a pointer to the client data object.
50 wxClientData
* GetClientObject() const;
53 Set the untyped client data.
55 void SetClientData(void* data
);
58 Set the client data object. Any previous object will be deleted.
60 void SetClientObject(wxClientData
* data
);
69 All classes deriving from wxEvtHandler
70 (such as all controls and wxApp)
71 can hold arbitrary data which is here referred to as "client data".
72 This is useful e.g. for scripting languages which need to handle
73 shadow objects for most of wxWidgets' classes and which store
74 a handle to such a shadow class as client data in that class.
75 This data can either be of type void - in which case the data
76 @e container does not take care of freeing the data again
77 or it is of type wxClientData or its derivatives. In that case the
78 container (e.g. a control) will free the memory itself later.
79 Note that you @e must not assign both void data and data
80 derived from the wxClientData class to a container.
82 Some controls can hold various items and these controls can
83 additionally hold client data for each item. This is the case for
85 and wxListBox. wxTreeCtrl
86 has a specialized class wxTreeItemData
87 for each item in the tree.
89 If you want to add client data to your own classes, you may
90 use the mix-in class wxClientDataContainer.
95 @see wxEvtHandler, wxTreeItemData, wxStringClientData, wxClientDataContainer
114 @class wxStringClientData
115 @wxheader{clntdata.h}
117 Predefined client data class for holding a string.
122 class wxStringClientData
: public wxClientData
127 Create client data with string.
129 wxStringClientData();
130 wxStringClientData(const wxString
& data
);
134 Get string client data.
136 const wxString
GetData() const;
139 Set string client data.
141 void SetData(const wxString
& data
);