Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / interface / wx / clntdata.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clntdata.h
3 // Purpose: interface of wxClientData[Container] and wxStringClientData
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxClientDataContainer
10
11 This class is a mixin that provides storage and management of "client data".
12 This data can either be of type void - in which case the data
13 @e container does not take care of freeing the data again or it is of
14 type wxClientData or its derivatives. In that case the container will free
15 the memory itself later. Note that you @e must not assign both void data
16 and data derived from the wxClientData class to a container.
17
18 @note This functionality is currently duplicated in wxEvtHandler in order
19 to avoid having more than one vtable in that class hierarchy.
20
21 @library{wxbase}
22 @category{containers}
23
24 @see wxEvtHandler, wxClientData
25 */
26 class wxClientDataContainer
27 {
28 public:
29 /**
30 Default constructor.
31 */
32 wxClientDataContainer();
33
34 /**
35 Destructor.
36 */
37 virtual ~wxClientDataContainer();
38
39 /**
40 Get the untyped client data.
41 */
42 void* GetClientData() const;
43
44 /**
45 Get a pointer to the client data object.
46 */
47 wxClientData* GetClientObject() const;
48
49 /**
50 Set the untyped client data.
51 */
52 void SetClientData(void* data);
53
54 /**
55 Set the client data object. Any previous object will be deleted.
56 */
57 void SetClientObject(wxClientData* data);
58 };
59
60
61
62 /**
63 @class wxClientData
64
65 All classes deriving from wxEvtHandler (such as all controls and wxApp) can
66 hold arbitrary data which is here referred to as "client data". This is
67 useful e.g. for scripting languages which need to handle shadow objects for
68 most of wxWidgets' classes and which store a handle to such a shadow class
69 as client data in that class. This data can either be of type void - in
70 which case the data @e container does not take care of freeing the data
71 again or it is of type wxClientData or its derivatives. In that case the
72 container (e.g. a control) will free the memory itself later. Note that you
73 @e must not assign both void data and data derived from the wxClientData
74 class to a container.
75
76 Some controls can hold various items and these controls can additionally
77 hold client data for each item. This is the case for wxChoice, wxComboBox
78 and wxListBox. wxTreeCtrl has a specialized class wxTreeItemData for each
79 item in the tree.
80
81 If you want to add client data to your own classes, you may use the mix-in
82 class wxClientDataContainer.
83
84 @library{wxbase}
85 @category{containers}
86
87 @see wxEvtHandler, wxTreeItemData, wxStringClientData,
88 wxClientDataContainer
89 */
90 class wxClientData
91 {
92 public:
93 /**
94 Constructor.
95 */
96 wxClientData();
97
98 /**
99 Virtual destructor.
100 */
101 virtual ~wxClientData();
102 };
103
104
105
106 /**
107 @class wxStringClientData
108
109 Predefined client data class for holding a string.
110
111 @library{wxbase}
112 @category{containers}
113 */
114 class wxStringClientData : public wxClientData
115 {
116 public:
117 /**
118 Default constructor.
119 */
120 wxStringClientData();
121
122 /**
123 Create client data with string.
124 */
125 wxStringClientData(const wxString& data);
126
127 /**
128 Get string client data.
129 */
130 const wxString& GetData() const;
131
132 /**
133 Set string client data.
134 */
135 void SetData(const wxString& data);
136 };
137