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