]>
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 | ||
30 | \wxheading{See also} | |
31 | ||
32 | \helpref{wxEvtHandler}{wxevthandler}, \helpref{wxTreeItemData}{wxtreeitemdata}, | |
33 | \helpref{wxStringClientData}{wxstringclientdata}, \helpref{wxClientDataContainer}{wxclientdatacontainer} | |
34 | ||
35 | \latexignore{\rtfignore{\wxheading{Members}}} | |
36 | ||
37 | ||
38 | \membersection{wxClientData::wxClientData}\label{wxclientdatawxclientdata} | |
39 | ||
40 | \func{}{wxClientData}{\void} | |
41 | ||
42 | Constructor. | |
43 | ||
44 | \membersection{wxClientData::\destruct{wxClientData}}\label{wxclientdatadtor} | |
45 | ||
46 | \func{}{\destruct{wxClientData}}{\void} | |
47 | ||
48 | Virtual destructor. | |
49 | ||
50 | \section{\class{wxClientDataContainer}}\label{wxclientdatacontainer} | |
51 | ||
52 | This class is a mixin that provides storage and management of "client | |
53 | data." This data can either be of type void - in which case the data | |
54 | {\it container} does not take care of freeing the data again | |
dbd94b75 | 55 | or it is of type wxClientData or its derivatives. In that case the |
e3ba9f88 RR |
56 | container will free the memory itself later. |
57 | Note that you {\it must not} assign both void data and data | |
58 | derived from the wxClientData class to a container. | |
59 | ||
60 | NOTE: This functionality is currently duplicated in wxEvtHandler in | |
b11dd80f | 61 | order to avoid having more than one vtable in that class hierarchy. |
e3ba9f88 RR |
62 | |
63 | \wxheading{See also} | |
64 | ||
65 | \helpref{wxEvtHandler}{wxevthandler}, \helpref{wxClientData}{wxclientdata} | |
66 | ||
67 | \wxheading{Derived from} | |
68 | ||
69 | No base class | |
70 | ||
71 | \wxheading{Include files} | |
72 | ||
0e10e38d | 73 | <wx/clntdata.h> |
e3ba9f88 RR |
74 | |
75 | \wxheading{Data structures} | |
76 | ||
77 | \latexignore{\rtfignore{\wxheading{Members}}} | |
78 | ||
79 | ||
80 | \membersection{wxClientDataContainer::wxClientDataContainer}\label{wxclientdatacontainerwxclientdatacontainer} | |
81 | ||
82 | \func{}{wxClientDataContainer}{\void} | |
83 | ||
84 | ||
85 | \membersection{wxClientDataContainer::\destruct{wxClientDataContainer}}\label{wxclientdatacontainerdtor} | |
86 | ||
87 | \func{}{\destruct{wxClientDataContainer}}{\void} | |
88 | ||
89 | ||
90 | \membersection{wxClientDataContainer::GetClientData}\label{wxclientdatacontainergetclientdata} | |
91 | ||
92 | \constfunc{void*}{GetClientData}{\void} | |
93 | ||
94 | Get the untyped client data. | |
95 | ||
96 | \membersection{wxClientDataContainer::GetClientObject}\label{wxclientdatacontainergetclientobject} | |
97 | ||
98 | \constfunc{wxClientData*}{GetClientObject}{\void} | |
99 | ||
100 | Get a pointer to the client data object. | |
101 | ||
102 | \membersection{wxClientDataContainer::SetClientData}\label{wxclientdatacontainersetclientdata} | |
103 | ||
104 | \func{void}{SetClientData}{\param{void* }{data}} | |
105 | ||
106 | Set the untyped client data. | |
107 | ||
108 | \membersection{wxClientDataContainer::SetClientObject}\label{wxclientdatacontainersetclientobject} | |
109 | ||
110 | \func{void}{SetClientObject}{\param{wxClientData* }{data}} | |
111 | ||
112 | Set the client data object. Any previous object will be deleted. | |
113 |