]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: clntdata.h | |
3 | // Purpose: documentation for wxClientDataContainer class | |
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 | |
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. | |
7c913512 | 20 | |
23324ae1 FM |
21 | NOTE: This functionality is currently duplicated in wxEvtHandler in |
22 | order to avoid having more than one vtable in that class hierarchy. | |
7c913512 | 23 | |
23324ae1 FM |
24 | @library{wxbase} |
25 | @category{FIXME} | |
7c913512 | 26 | |
23324ae1 FM |
27 | @seealso |
28 | wxEvtHandler, wxClientData | |
29 | */ | |
7c913512 | 30 | class wxClientDataContainer |
23324ae1 FM |
31 | { |
32 | public: | |
33 | /** | |
34 | ||
35 | */ | |
36 | wxClientDataContainer(); | |
37 | ||
38 | /** | |
39 | ||
40 | */ | |
41 | ~wxClientDataContainer(); | |
42 | ||
43 | /** | |
44 | Get the untyped client data. | |
45 | */ | |
46 | void* GetClientData(); | |
47 | ||
48 | /** | |
49 | Get a pointer to the client data object. | |
50 | */ | |
51 | wxClientData* GetClientObject(); | |
52 | ||
53 | /** | |
54 | Set the untyped client data. | |
55 | */ | |
56 | void SetClientData(void* data); | |
57 | ||
58 | /** | |
59 | Set the client data object. Any previous object will be deleted. | |
60 | */ | |
61 | void SetClientObject(wxClientData* data); | |
62 | }; | |
63 | ||
64 | ||
65 | /** | |
66 | @class wxClientData | |
67 | @wxheader{clntdata.h} | |
7c913512 | 68 | |
23324ae1 FM |
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. | |
7c913512 | 81 | |
23324ae1 FM |
82 | Some controls can hold various items and these controls can |
83 | additionally hold client data for each item. This is the case for | |
84 | wxChoice, wxComboBox | |
85 | and wxListBox. wxTreeCtrl | |
86 | has a specialized class wxTreeItemData | |
87 | for each item in the tree. | |
7c913512 | 88 | |
23324ae1 FM |
89 | If you want to add client data to your own classes, you may |
90 | use the mix-in class wxClientDataContainer. | |
7c913512 | 91 | |
23324ae1 FM |
92 | @library{wxbase} |
93 | @category{FIXME} | |
7c913512 | 94 | |
23324ae1 FM |
95 | @seealso |
96 | wxEvtHandler, wxTreeItemData, wxStringClientData, wxClientDataContainer | |
97 | */ | |
7c913512 | 98 | class wxClientData |
23324ae1 FM |
99 | { |
100 | public: | |
101 | /** | |
102 | Constructor. | |
103 | */ | |
104 | wxClientData(); | |
105 | ||
106 | /** | |
107 | Virtual destructor. | |
108 | */ | |
109 | ~wxClientData(); | |
110 | }; | |
111 | ||
112 | ||
113 | /** | |
114 | @class wxStringClientData | |
115 | @wxheader{clntdata.h} | |
7c913512 | 116 | |
23324ae1 | 117 | Predefined client data class for holding a string. |
7c913512 | 118 | |
23324ae1 FM |
119 | @library{wxbase} |
120 | @category{FIXME} | |
121 | */ | |
122 | class wxStringClientData : public wxClientData | |
123 | { | |
124 | public: | |
125 | //@{ | |
126 | /** | |
127 | Create client data with string. | |
128 | */ | |
129 | wxStringClientData(); | |
7c913512 | 130 | wxStringClientData(const wxString& data); |
23324ae1 FM |
131 | //@} |
132 | ||
133 | /** | |
134 | Get string client data. | |
135 | */ | |
136 | const wxString GetData(); | |
137 | ||
138 | /** | |
139 | Set string client data. | |
140 | */ | |
141 | void SetData(const wxString& data); | |
142 | }; |