]> git.saurik.com Git - wxWidgets.git/blame - interface/clntdata.h
More initial reviews of [u*-v*] interface headers.
[wxWidgets.git] / interface / clntdata.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: clntdata.h
d18d9f60 3// Purpose: interface of wxClientData[Container] and wxStringClientData
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxClientDataContainer
11 @wxheader{clntdata.h}
7c913512 12
23324ae1
FM
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
d18d9f60
BP
15 @e container does not take care of freeing the data again or it is of
16 type wxClientData or its derivatives. In that case the container will free
17 the memory itself later. Note that you @e must not assign both void data
18 and data derived from the wxClientData class to a container.
7c913512 19
d18d9f60
BP
20 @note This functionality is currently duplicated in wxEvtHandler in order
21 to avoid having more than one vtable in that class hierarchy.
7c913512 22
23324ae1 23 @library{wxbase}
d18d9f60 24 @category{containers}
7c913512 25
e54c96f1 26 @see wxEvtHandler, wxClientData
23324ae1 27*/
7c913512 28class wxClientDataContainer
23324ae1
FM
29{
30public:
31 /**
d18d9f60 32 Default constructor.
23324ae1
FM
33 */
34 wxClientDataContainer();
35
36 /**
d18d9f60 37 Destructor.
23324ae1
FM
38 */
39 ~wxClientDataContainer();
40
41 /**
42 Get the untyped client data.
43 */
328f5751 44 void* GetClientData() const;
23324ae1
FM
45
46 /**
47 Get a pointer to the client data object.
48 */
328f5751 49 wxClientData* GetClientObject() const;
23324ae1
FM
50
51 /**
52 Set the untyped client data.
53 */
54 void SetClientData(void* data);
55
56 /**
57 Set the client data object. Any previous object will be deleted.
58 */
59 void SetClientObject(wxClientData* data);
60};
61
62
e54c96f1 63
23324ae1
FM
64/**
65 @class wxClientData
66 @wxheader{clntdata.h}
7c913512 67
d18d9f60
BP
68 All classes deriving from wxEvtHandler (such as all controls and wxApp) can
69 hold arbitrary data which is here referred to as "client data". This is
70 useful e.g. for scripting languages which need to handle shadow objects for
71 most of wxWidgets' classes and which store a handle to such a shadow class
72 as client data in that class. This data can either be of type void - in
73 which case the data @e container does not take care of freeing the data
74 again or it is of type wxClientData or its derivatives. In that case the
75 container (e.g. a control) will free the memory itself later. Note that you
76 @e must not assign both void data and data derived from the wxClientData
77 class to a container.
78
79 Some controls can hold various items and these controls can additionally
80 hold client data for each item. This is the case for wxChoice, wxComboBox
81 and wxListBox. wxTreeCtrl has a specialized class wxTreeItemData for each
82 item in the tree.
83
84 If you want to add client data to your own classes, you may use the mix-in
85 class wxClientDataContainer.
7c913512 86
23324ae1 87 @library{wxbase}
d18d9f60 88 @category{containers}
7c913512 89
d18d9f60
BP
90 @see wxEvtHandler, wxTreeItemData, wxStringClientData,
91 wxClientDataContainer
23324ae1 92*/
7c913512 93class wxClientData
23324ae1
FM
94{
95public:
96 /**
97 Constructor.
98 */
99 wxClientData();
100
101 /**
102 Virtual destructor.
103 */
104 ~wxClientData();
105};
106
107
e54c96f1 108
23324ae1
FM
109/**
110 @class wxStringClientData
111 @wxheader{clntdata.h}
7c913512 112
23324ae1 113 Predefined client data class for holding a string.
7c913512 114
23324ae1 115 @library{wxbase}
d18d9f60 116 @category{containers}
23324ae1
FM
117*/
118class wxStringClientData : public wxClientData
119{
120public:
23324ae1 121 /**
d18d9f60 122 Default constructor.
23324ae1
FM
123 */
124 wxStringClientData();
d18d9f60
BP
125
126 /**
127 Create client data with string.
128 */
7c913512 129 wxStringClientData(const wxString& data);
23324ae1
FM
130
131 /**
132 Get string client data.
133 */
328f5751 134 const wxString GetData() const;
23324ae1
FM
135
136 /**
137 Set string client data.
138 */
139 void SetData(const wxString& data);
140};
e54c96f1 141