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