]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/clntdata.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxClientData[Container] and wxStringClientData
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxClientDataContainer
12 This class is a mixin that provides storage and management of "client
13 data." This data can either be of type void - in which case the data
14 @e container does not take care of freeing the data again or it is of
15 type wxClientData or its derivatives. In that case the container will free
16 the memory itself later. Note that you @e must not assign both void data
17 and data derived from the wxClientData class to a container.
19 @note This functionality is currently duplicated in wxEvtHandler in order
20 to avoid having more than one vtable in that class hierarchy.
25 @see wxEvtHandler, wxClientData
27 class wxClientDataContainer
33 wxClientDataContainer();
38 virtual ~wxClientDataContainer();
41 Get the untyped client data.
43 void* GetClientData() const;
46 Get a pointer to the client data object.
48 wxClientData
* GetClientObject() const;
51 Set the untyped client data.
53 void SetClientData(void* data
);
56 Set the client data object. Any previous object will be deleted.
58 void SetClientObject(wxClientData
* data
);
66 All classes deriving from wxEvtHandler (such as all controls and wxApp) can
67 hold arbitrary data which is here referred to as "client data". This is
68 useful e.g. for scripting languages which need to handle shadow objects for
69 most of wxWidgets' classes and which store a handle to such a shadow class
70 as client data in that class. This data can either be of type void - in
71 which case the data @e container does not take care of freeing the data
72 again or it is of type wxClientData or its derivatives. In that case the
73 container (e.g. a control) will free the memory itself later. Note that you
74 @e must not assign both void data and data derived from the wxClientData
77 Some controls can hold various items and these controls can additionally
78 hold client data for each item. This is the case for wxChoice, wxComboBox
79 and wxListBox. wxTreeCtrl has a specialized class wxTreeItemData for each
82 If you want to add client data to your own classes, you may use the mix-in
83 class wxClientDataContainer.
88 @see wxEvtHandler, wxTreeItemData, wxStringClientData,
102 virtual ~wxClientData();
108 @class wxStringClientData
110 Predefined client data class for holding a string.
113 @category{containers}
115 class wxStringClientData
: public wxClientData
121 wxStringClientData();
124 Create client data with string.
126 wxStringClientData(const wxString
& data
);
129 Get string client data.
131 const wxString
& GetData() const;
134 Set string client data.
136 void SetData(const wxString
& data
);