-
Notifications
You must be signed in to change notification settings - Fork 2
/
oXCompLib.h
112 lines (94 loc) · 4.16 KB
/
oXCompLib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* omnis.xcomp.framework
* =====================
*
* oXCompLib.h
* Base class for our library definition.
*
* You need to subclass this and implement the needed methods then instantiate your class as a global called gXCompLib
*
* Bastiaan Olij
*
* https://github.com/BastiaanOlij/omnis.xcomp.framework
*
* Todos:
* - Change from using qArray to std::vector for objects and components
*
*/
// our base component library already includes everything else we need...
#include "oBaseComponent.h"
#include "oBaseNVComponent.h"
#include "oBaseVisComponent.h"
#ifndef xcomplibh
#define xcomplibh
// Array of objects
typedef qArray<ECOobject> qECOobjects;
// Visual object definition
struct OXFcomponent {
int componentType; // Type of component
unsigned int componentID; // Resource ID for this component, also the object ID
unsigned int bitmapID; // Resource ID for this components bitmap (only for visible objects)
qlong flags; // flags (only for NV-objects)
qlong groupResID; // group resource ID (only for NV-objects)
void *(*newObjectFunction)(void); // Function pointer to the function that returns a new instance
qProperties *mProperties; // Array containing property definitions
qMethods *mMethods; // Array containing method definitions
unsigned int mEventMethodID; // Resource ID for the first line of our $event method text for our object
qEvents *mEvents; // Array containing our event definitions
};
// Array of components
typedef qArray<OXFcomponent> qComponents;
class oXCompLib {
private:
qECOobjects mECOobjects; // our object array converted to Omnis
qArray<uint> mVisIndex; // index of visual components
qComponents mComponents; // array of component definitions
vMethods mStaticMethods; // array of static methods
protected:
public:
oXCompLib(void); // constructor
~oXCompLib(void); // destructor
// info
qint getResourceID(void); // get our library resource id
virtual qshort major(); // get major version number
virtual qshort minor(); // get minor version number
// access to components
qECOobjects *objects(void); // return our objects as an Omnis structure
void addComponent(OXFcomponent pAdd); // Add a component
unsigned long numberOfvisComps(void); // return number of visual components
OXFcomponent visCompByIndex(uint pIndex); // return visual component by index using our vis index
unsigned long numberOfComponents(void); // return the number of components in our library
OXFcomponent componentByIndex(uint pIndex); // return component by index
OXFcomponent componentByID(long pCompID); // return component by component ID
oBaseComponent *instantiateComponent(long pCompID, EXTCompInfo *pECI, HWND pHWND, LPARAM pParam); // instantiate a component by component ID
// access to static functions
void addStaticMethods(ECOmethodEvent *pMethods, int pCount);
unsigned long numberOfStaticMethods(void); // number of static methods in our library
ECOmethodEvent *staticMethods(void); // return pointer to array of static methods in our library
// access to meta data
qProperties *properties(long pCompID); // return property meta data for this object
qMethods *methods(long pCompID); // return method meta data for this object
unsigned int eventMethodID(long pCompID); // return our event method resource ID
qEvents *events(long pCompID); // return event meta data for this object
// calls from our wndproc
virtual qint ecm_connect(void); // initialize our library
virtual qbool ecm_disconnect(void); // cleanup
// need to add methods for returning static method information
virtual int invokeMethod(qlong pMethodId, EXTCompInfo *pECI); // invoke a static method
};
// This class must be implemented in your library (on windows its not enough to just have a class definition...)
// An instance of this class is created to manage your library.
class mainlib : public oXCompLib {
private:
static mainlib *singleton;
public:
static mainlib *get_singleton();
static void cleanup();
// implement these methods
virtual qshort major(); // get major version number
virtual qshort minor(); // get minor version number
virtual qint ecm_connect(void);
virtual qbool ecm_disconnect(void);
virtual int invokeMethod(qlong pMethodId, EXTCompInfo *pECI);
};
#endif