]> git.saurik.com Git - wxWidgets.git/blob - interface/clntdata.h
several g++ 4 warning fixes
[wxWidgets.git] / interface / clntdata.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clntdata.h
3 // Purpose: interface of wxClientDataContainer
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
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.
20
21 NOTE: This functionality is currently duplicated in wxEvtHandler in
22 order to avoid having more than one vtable in that class hierarchy.
23
24 @library{wxbase}
25 @category{FIXME}
26
27 @see wxEvtHandler, wxClientData
28 */
29 class wxClientDataContainer
30 {
31 public:
32 /**
33
34 */
35 wxClientDataContainer();
36
37 /**
38
39 */
40 ~wxClientDataContainer();
41
42 /**
43 Get the untyped client data.
44 */
45 void* GetClientData() const;
46
47 /**
48 Get a pointer to the client data object.
49 */
50 wxClientData* GetClientObject() const;
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
64
65 /**
66 @class wxClientData
67 @wxheader{clntdata.h}
68
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.
81
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.
88
89 If you want to add client data to your own classes, you may
90 use the mix-in class wxClientDataContainer.
91
92 @library{wxbase}
93 @category{FIXME}
94
95 @see wxEvtHandler, wxTreeItemData, wxStringClientData, wxClientDataContainer
96 */
97 class wxClientData
98 {
99 public:
100 /**
101 Constructor.
102 */
103 wxClientData();
104
105 /**
106 Virtual destructor.
107 */
108 ~wxClientData();
109 };
110
111
112
113 /**
114 @class wxStringClientData
115 @wxheader{clntdata.h}
116
117 Predefined client data class for holding a string.
118
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();
130 wxStringClientData(const wxString& data);
131 //@}
132
133 /**
134 Get string client data.
135 */
136 const wxString GetData() const;
137
138 /**
139 Set string client data.
140 */
141 void SetData(const wxString& data);
142 };
143