]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: clntdata.h | |
e54c96f1 | 3 | // Purpose: interface of wxClientDataContainer |
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 | |
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 | |
e54c96f1 | 27 | @see wxEvtHandler, wxClientData |
23324ae1 | 28 | */ |
7c913512 | 29 | class wxClientDataContainer |
23324ae1 FM |
30 | { |
31 | public: | |
32 | /** | |
33 | ||
34 | */ | |
35 | wxClientDataContainer(); | |
36 | ||
37 | /** | |
38 | ||
39 | */ | |
40 | ~wxClientDataContainer(); | |
41 | ||
42 | /** | |
43 | Get the untyped client data. | |
44 | */ | |
328f5751 | 45 | void* GetClientData() const; |
23324ae1 FM |
46 | |
47 | /** | |
48 | Get a pointer to the client data object. | |
49 | */ | |
328f5751 | 50 | wxClientData* GetClientObject() const; |
23324ae1 FM |
51 | |
52 | /** | |
53 | Set the untyped client data. | |
54 | */ | |
55 | void SetClientData(void* data); | |
56 | ||
57 | /** | |
58 | Set the client data object. Any previous object will be deleted. | |
59 | */ | |
60 | void SetClientObject(wxClientData* data); | |
61 | }; | |
62 | ||
63 | ||
e54c96f1 | 64 | |
23324ae1 FM |
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 | |
e54c96f1 | 95 | @see wxEvtHandler, wxTreeItemData, wxStringClientData, wxClientDataContainer |
23324ae1 | 96 | */ |
7c913512 | 97 | class wxClientData |
23324ae1 FM |
98 | { |
99 | public: | |
100 | /** | |
101 | Constructor. | |
102 | */ | |
103 | wxClientData(); | |
104 | ||
105 | /** | |
106 | Virtual destructor. | |
107 | */ | |
108 | ~wxClientData(); | |
109 | }; | |
110 | ||
111 | ||
e54c96f1 | 112 | |
23324ae1 FM |
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 | */ | |
328f5751 | 136 | const wxString GetData() const; |
23324ae1 FM |
137 | |
138 | /** | |
139 | Set string client data. | |
140 | */ | |
141 | void SetData(const wxString& data); | |
142 | }; | |
e54c96f1 | 143 |