rendered paste bodyIndex: plugin-class.cpp
===================================================================
--- plugin-class.cpp (revision 79230)
+++ plugin-class.cpp (working copy)
@@ -278,3 +278,51 @@
return false;
}
+
+//
+// These are methods for the DependencyObject wrapper
+//
+bool
+PluginDependencyObject::ClassHasProperty (NPObject *npobj, NPIdentifier name)
+{
+ //
+ // Am not sure if this is how you test this
+ //
+ if (strcmp (name, "getHost()") == 0){
+ return TRUE;
+ }
+
+ DependencyProperty *p = dob->GetDependencyProperty (name);
+ if (p == NULL)
+ return FALSE;
+
+ Value *val = dob->GetValue (p);
+
+ if (val == 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+bool
+PluginDependencyObject:: ClassGetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result)
+{
+ //
+ // Am not sure if this is how you test this
+ //
+ if (strcmp (name, "getHost()") == 0){
+ // Dont know what to do with refcount, nor wrapping, but you get the idea
+ return host;
+ }
+
+ DependencyProperty *p = dob->GetDependencyProperty (name);
+ if (p == NULL)
+ return NULL;
+
+ Value *val = dob->GetValue (p);
+
+ if (val == 0)
+ return NULL;
+
+ return convert_val_to_something_jscript_can_use ();
+}
Index: plugin-class.h
===================================================================
--- plugin-class.h (revision 79230)
+++ plugin-class.h (working copy)
@@ -50,3 +50,19 @@
virtual bool ClassHasProperty (NPObject *npobj, NPIdentifier name);
virtual bool ClassGetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result);
};
+
+//
+// This is a PluginClass that can wrap a DependencyObject
+//
+class PluginDependencyObject : public PluginClass {
+
+ public:
+ DependencyObject *dob;
+ DependencyObject *host;
+
+ public PluginDependencyObject (PluginRoot *host, DependencyObject *dob);
+
+ virtual bool ClassHasProperty (NPObject *npobj, NPIdentifier name);
+ virtual bool ClassGetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result);
+}
+