]> git.saurik.com Git - wxWidgets.git/blob - interface/clntdata.h
GetSocketManager() has no GUI-specific version under Darwin finally
[wxWidgets.git] / interface / clntdata.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clntdata.h
3 // Purpose: interface of wxClientData[Container] and wxStringClientData
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxClientDataContainer
11 @wxheader{clntdata.h}
12
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 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.
19
20 @note This functionality is currently duplicated in wxEvtHandler in order
21 to avoid having more than one vtable in that class hierarchy.
22
23 @library{wxbase}
24 @category{containers}
25
26 @see wxEvtHandler, wxClientData
27 */
28 class wxClientDataContainer
29 {
30 public:
31 /**
32 Default constructor.
33 */
34 wxClientDataContainer();
35
36 /**
37 Destructor.
38 */
39 ~wxClientDataContainer();
40
41 /**
42 Get the untyped client data.
43 */
44 void* GetClientData() const;
45
46 /**
47 Get a pointer to the client data object.
48 */
49 wxClientData* GetClientObject() const;
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
63
64 /**
65 @class wxClientData
66 @wxheader{clntdata.h}
67
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.
86
87 @library{wxbase}
88 @category{containers}
89
90 @see wxEvtHandler, wxTreeItemData, wxStringClientData,
91 wxClientDataContainer
92 */
93 class wxClientData
94 {
95 public:
96 /**
97 Constructor.
98 */
99 wxClientData();
100
101 /**
102 Virtual destructor.
103 */
104 ~wxClientData();
105 };
106
107
108
109 /**
110 @class wxStringClientData
111 @wxheader{clntdata.h}
112
113 Predefined client data class for holding a string.
114
115 @library{wxbase}
116 @category{containers}
117 */
118 class wxStringClientData : public wxClientData
119 {
120 public:
121 /**
122 Default constructor.
123 */
124 wxStringClientData();
125
126 /**
127 Create client data with string.
128 */
129 wxStringClientData(const wxString& data);
130
131 /**
132 Get string client data.
133 */
134 const wxString GetData() const;
135
136 /**
137 Set string client data.
138 */
139 void SetData(const wxString& data);
140 };
141