]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/xtistrm.h | |
3 | // Purpose: streaming runtime metadata information (extended class info) | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 27/07/03 | |
7 | // Copyright: (c) 2003 Stefan Csomor | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _CODEDEPERSISTER_ | |
12 | #define _CODEDEPERSISTER_ | |
13 | ||
14 | #include "wx/defs.h" | |
15 | #include "wx/sstream.h" | |
16 | ||
17 | /* | |
18 | wxObjectCodeReaderCallback implements the callbacks that will depersist | |
19 | an object into a C++ initialization function. | |
20 | */ | |
21 | ||
22 | class WXDLLIMPEXP_BASE wxTextOutputStream; | |
23 | ||
24 | class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectReaderCallback | |
25 | { | |
26 | private: | |
27 | struct wxObjectCodeReaderCallbackInternal; | |
28 | wxObjectCodeReaderCallbackInternal * m_data; | |
29 | wxString& m_headerincludes; | |
30 | wxString& m_source; | |
31 | ||
32 | public: | |
33 | wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source); | |
34 | virtual ~wxObjectCodeReaderCallback(); | |
35 | ||
36 | // allocate the new object on the heap, that object will have the passed in ID | |
37 | virtual void AllocateObject(int objectID, wxClassInfo *classInfo, | |
38 | wxStringToAnyHashMap &metadata); | |
39 | ||
40 | // initialize the already allocated object having the ID objectID | |
41 | // with the Create method creation parameters which are objects are | |
42 | // having their Ids passed in objectIDValues having objectId <> wxInvalidObjectID | |
43 | ||
44 | virtual void CreateObject(int objectID, | |
45 | const wxClassInfo *classInfo, | |
46 | int paramCount, | |
47 | wxAny *variantValues, | |
48 | int *objectIDValues, | |
49 | const wxClassInfo **objectClassInfos, | |
50 | wxStringToAnyHashMap &metadata | |
51 | ); | |
52 | ||
53 | // construct the new object on the heap, that object will have the | |
54 | // passed in ID (for objects that don't support allocate-create type | |
55 | // of creation) creation parameters which are objects are having their | |
56 | // Ids passed in objectIDValues having objectId <> wxInvalidObjectID | |
57 | ||
58 | virtual void ConstructObject(int objectID, | |
59 | const wxClassInfo *classInfo, | |
60 | int paramCount, | |
61 | wxAny *VariantValues, | |
62 | int *objectIDValues, | |
63 | const wxClassInfo **objectClassInfos, | |
64 | wxStringToAnyHashMap &metadata); | |
65 | ||
66 | // destroy the heap-allocated object having the ID objectID, this may | |
67 | // be used if an object is embedded in another object and set via value | |
68 | // semantics, so the intermediate object can be destroyed after safely | |
69 | virtual void DestroyObject(int objectID, wxClassInfo *classInfo); | |
70 | ||
71 | // set the corresponding property | |
72 | virtual void SetProperty(int objectID, | |
73 | const wxClassInfo *classInfo, | |
74 | const wxPropertyInfo* propertyInfo, | |
75 | const wxAny &variantValue); | |
76 | ||
77 | // sets the corresponding property (value is an object) | |
78 | virtual void SetPropertyAsObject(int objectId, | |
79 | const wxClassInfo *classInfo, | |
80 | const wxPropertyInfo* propertyInfo, | |
81 | int valueObjectId); | |
82 | ||
83 | // adds an element to a property collection | |
84 | virtual void AddToPropertyCollection( int objectID, | |
85 | const wxClassInfo *classInfo, | |
86 | const wxPropertyInfo* propertyInfo, | |
87 | const wxAny &VariantValue); | |
88 | ||
89 | // sets the corresponding property (value is an object) | |
90 | virtual void AddToPropertyCollectionAsObject(int objectID, | |
91 | const wxClassInfo *classInfo, | |
92 | const wxPropertyInfo* propertyInfo, | |
93 | int valueObjectId); | |
94 | ||
95 | // sets the corresponding event handler | |
96 | virtual void SetConnect(int eventSourceObjectID, | |
97 | const wxClassInfo *eventSourceClassInfo, | |
98 | const wxPropertyInfo *delegateInfo, | |
99 | const wxClassInfo *eventSinkClassInfo, | |
100 | const wxHandlerInfo* handlerInfo, | |
101 | int eventSinkObjectID ); | |
102 | ||
103 | // utility function exposed for callbacks | |
104 | wxString ValueAsCode( const wxAny ¶m ); | |
105 | }; | |
106 | ||
107 | #endif |