aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/dependency
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Wasabi/api/dependency')
-rw-r--r--Src/Wasabi/api/dependency/api_dependent.cpp2
-rw-r--r--Src/Wasabi/api/dependency/api_dependent.h54
-rw-r--r--Src/Wasabi/api/dependency/api_dependentviewer.cpp2
-rw-r--r--Src/Wasabi/api/dependency/api_dependentviewer.h30
4 files changed, 88 insertions, 0 deletions
diff --git a/Src/Wasabi/api/dependency/api_dependent.cpp b/Src/Wasabi/api/dependency/api_dependent.cpp
new file mode 100644
index 00000000..9ba862df
--- /dev/null
+++ b/Src/Wasabi/api/dependency/api_dependent.cpp
@@ -0,0 +1,2 @@
+#include <precomp.h>
+#include "api_dependent.h" \ No newline at end of file
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
diff --git a/Src/Wasabi/api/dependency/api_dependentviewer.cpp b/Src/Wasabi/api/dependency/api_dependentviewer.cpp
new file mode 100644
index 00000000..df550071
--- /dev/null
+++ b/Src/Wasabi/api/dependency/api_dependentviewer.cpp
@@ -0,0 +1,2 @@
+#include <precomp.h>
+#include "api_dependentviewer.h" \ No newline at end of file
diff --git a/Src/Wasabi/api/dependency/api_dependentviewer.h b/Src/Wasabi/api/dependency/api_dependentviewer.h
new file mode 100644
index 00000000..160bac9d
--- /dev/null
+++ b/Src/Wasabi/api/dependency/api_dependentviewer.h
@@ -0,0 +1,30 @@
+#ifndef __WASABI_API_DEPENDENTVIEWER_H
+#define __WASABI_API_DEPENDENTVIEWER_H
+
+#include <bfc/dispatch.h>
+#include <bfc/platform/types.h>
+class ifc_dependent;
+
+class NOVTABLE ifc_dependentviewer : public Dispatchable
+{
+protected:
+ ifc_dependentviewer() {}
+ ~ifc_dependentviewer() {}
+public:
+ // item calls when it changes or disappears, or whatever
+ int dependentViewer_callback(ifc_dependent *item, const GUID *classguid, int cb, intptr_t param1 = 0, intptr_t param2 = 0, void *ptr = NULL, size_t ptrlen = 0);
+
+ DISPATCH_CODES
+ {
+ DEPENDENTVIEWER_CALLBACK = 10,
+ };
+};
+
+inline int ifc_dependentviewer::dependentViewer_callback(ifc_dependent *item, const GUID *classguid, int cb, intptr_t param1 , intptr_t param2 , void *ptr , size_t ptrlen)
+{
+ return _call(DEPENDENTVIEWER_CALLBACK, (int)0, item, classguid, cb, param1, param2, ptr, ptrlen);
+}
+
+typedef ifc_dependentviewer api_dependentviewer;
+
+#endif