]>
Commit | Line | Data |
---|---|---|
e3ba9f88 RR |
1 | \section{\class{wxClientData}}\label{wxclientdata} |
2 | ||
3 | All classes deriving from \helpref{wxEvtHandler}{wxevthandler} | |
4 | (such as all controls and \helpref{wxApp}{wxapp}) | |
5 | can hold arbitrary data which is here referred to as "client data". | |
6 | This is useful e.g. for scripting languages which need to handle | |
fc2171bd | 7 | shadow objects for most of wxWidgets' classes and which store |
e3ba9f88 RR |
8 | a handle to such a shadow class as client data in that class. |
9 | This data can either be of type void - in which case the data | |
10 | {\it container} does not take care of freeing the data again | |
dbd94b75 | 11 | or it is of type wxClientData or its derivatives. In that case the |
e3ba9f88 RR |
12 | container (e.g. a control) will free the memory itself later. |
13 | Note that you {\it must not} assign both void data and data | |
14 | derived from the wxClientData class to a container. | |
15 | ||
16 | Some controls can hold various items and these controls can | |
17 | additionally hold client data for each item. This is the case for | |
18 | \helpref{wxChoice}{wxchoice}, \helpref{wxComboBox}{wxcombobox} | |
19 | and \helpref{wxListBox}{wxlistbox}. \helpref{wxTreeCtrl}{wxtreectrl} | |
20 | has a specialized class \helpref{wxTreeItemData}{wxtreeitemdata} | |
21 | for each item in the tree. | |
22 | ||
23 | If you want to add client data to your own classes, you may | |
24 | use the mix-in class \helpref{wxClientDataContainer}{wxclientdatacontainer}. | |
25 | ||
26 | \wxheading{Include files} | |
27 | ||
28 | <wx/clntdata.h> | |
29 | ||
a7af285d VZ |
30 | \wxheading{Library} |
31 | ||
32 | \helpref{wxBase}{librarieslist} | |
33 | ||
e3ba9f88 RR |
34 | \wxheading{See also} |
35 | ||
36 | \helpref{wxEvtHandler}{wxevthandler}, \helpref{wxTreeItemData}{wxtreeitemdata}, | |
37 | \helpref{wxStringClientData}{wxstringclientdata}, \helpref{wxClientDataContainer}{wxclientdatacontainer} | |
38 | ||
39 | \latexignore{\rtfignore{\wxheading{Members}}} | |
40 | ||
41 | ||
42 | \membersection{wxClientData::wxClientData}\label{wxclientdatawxclientdata} | |
43 | ||
44 | \func{}{wxClientData}{\void} | |
45 | ||
46 | Constructor. | |
47 | ||
48 | \membersection{wxClientData::\destruct{wxClientData}}\label{wxclientdatadtor} | |
49 | ||
50 | \func{}{\destruct{wxClientData}}{\void} | |
51 | ||
52 | Virtual destructor. | |
53 | ||
54 | \section{\class{wxClientDataContainer}}\label{wxclientdatacontainer} | |
55 | ||
56 | This class is a mixin that provides storage and management of "client | |
57 | data." This data can either be of type void - in which case the data | |
58 | {\it container} does not take care of freeing the data again | |
dbd94b75 | 59 | or it is of type wxClientData or its derivatives. In that case the |
e3ba9f88 RR |
60 | container will free the memory itself later. |
61 | Note that you {\it must not} assign both void data and data | |
62 | derived from the wxClientData class to a container. | |
63 | ||
64 | NOTE: This functionality is currently duplicated in wxEvtHandler in | |
b11dd80f | 65 | order to avoid having more than one vtable in that class hierarchy. |
e3ba9f88 RR |
66 | |
67 | \wxheading{See also} | |
68 | ||
69 | \helpref{wxEvtHandler}{wxevthandler}, \helpref{wxClientData}{wxclientdata} | |
70 | ||
71 | \wxheading{Derived from} | |
72 | ||
73 | No base class | |
74 | ||
75 | \wxheading{Include files} | |
76 | ||
0e10e38d | 77 | <wx/clntdata.h> |
e3ba9f88 | 78 | |
a7af285d VZ |
79 | \wxheading{Library} |
80 | ||
81 | \helpref{wxBase}{librarieslist} | |
82 | ||
e3ba9f88 RR |
83 | \wxheading{Data structures} |
84 | ||
85 | \latexignore{\rtfignore{\wxheading{Members}}} | |
86 | ||
87 | ||
88 | \membersection{wxClientDataContainer::wxClientDataContainer}\label{wxclientdatacontainerwxclientdatacontainer} | |
89 | ||
90 | \func{}{wxClientDataContainer}{\void} | |
91 | ||
92 | ||
93 | \membersection{wxClientDataContainer::\destruct{wxClientDataContainer}}\label{wxclientdatacontainerdtor} | |
94 | ||
95 | \func{}{\destruct{wxClientDataContainer}}{\void} | |
96 | ||
97 | ||
98 | \membersection{wxClientDataContainer::GetClientData}\label{wxclientdatacontainergetclientdata} | |
99 | ||
100 | \constfunc{void*}{GetClientData}{\void} | |
101 | ||
102 | Get the untyped client data. | |
103 | ||
104 | \membersection{wxClientDataContainer::GetClientObject}\label{wxclientdatacontainergetclientobject} | |
105 | ||
106 | \constfunc{wxClientData*}{GetClientObject}{\void} | |
107 | ||
108 | Get a pointer to the client data object. | |
109 | ||
110 | \membersection{wxClientDataContainer::SetClientData}\label{wxclientdatacontainersetclientdata} | |
111 | ||
112 | \func{void}{SetClientData}{\param{void* }{data}} | |
113 | ||
114 | Set the untyped client data. | |
115 | ||
116 | \membersection{wxClientDataContainer::SetClientObject}\label{wxclientdatacontainersetclientobject} | |
117 | ||
118 | \func{void}{SetClientObject}{\param{wxClientData* }{data}} | |
119 | ||
120 | Set the client data object. Any previous object will be deleted. | |
121 |