aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/dependency/api_dependent.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Wasabi/api/dependency/api_dependent.h')
-rw-r--r--Src/Wasabi/api/dependency/api_dependent.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/Src/Wasabi/api/dependency/api_dependent.h b/Src/Wasabi/api/dependency/api_dependent.h
new file mode 100644
index 00000000..23b7a54a
--- /dev/null
+++ b/Src/Wasabi/api/dependency/api_dependent.h
@@ -0,0 +1,54 @@
+#ifndef __WASABI_API_DEPENDENT_H
+#define __WASABI_API_DEPENDENT_H
+
+#include <bfc/dispatch.h>
+#include "api_dependentviewer.h"
+
+// we define some common event codes here. if your object needs more send
+// them as parameters to OBJECTSPECIFIC
+
+// some system-level codes for cb param. You can implement your own events
+// with DEPCB_EVENT and the parameters
+namespace DependentCB
+{
+ enum {
+ DEPCB_NOP = 0,
+ DEPCB_DELETED = 100, // object being deleted
+ DEPCB_EVENT = 1000, // object-specific event. use param1 etc to send your messages
+ };
+};
+
+class NOVTABLE ifc_dependent : public Dispatchable
+{
+protected:
+ ifc_dependent() {}
+ ~ifc_dependent() {}
+public:
+ void dependent_regViewer(ifc_dependentviewer *viewer, int add) ;
+ void *dependent_getInterface(const GUID *classguid);
+
+ DISPATCH_CODES
+ {
+ API_DEPENDENT_REGVIEWER = 10,
+ API_DEPENDENT_GETINTERFACE = 20,
+ };
+};
+
+inline void ifc_dependent::dependent_regViewer(api_dependentviewer *viewer, int add)
+ {
+ _voidcall(API_DEPENDENT_REGVIEWER, viewer, add);
+ }
+ inline void *ifc_dependent::dependent_getInterface(const GUID *classguid)
+ {
+ return _call(API_DEPENDENT_GETINTERFACE, (void *)0, classguid);
+ }
+
+
+// this is a helper for dependent_getInterface
+#define HANDLEGETINTERFACE(x) { \
+ if (*classguid == *x::depend_getClassGuid()) return static_cast<x *>(this); \
+ }
+
+typedef ifc_dependent api_dependent;
+
+#endif \ No newline at end of file