All pastes #560620 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-12 04:34 UTC
rendered paste body
Index: plugin-class.cpp
===================================================================
--- plugin-class.cpp    (revision 79230)
+++ plugin-class.cpp    (working copy)
@@ -278,3 +278,39 @@

        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;
+       }
+
+       //
+       // Now look the thing inside our children
+       //
+       // FIXME: Dont know how to navigate an object for its children looking for "name"
+}
+
+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;
+       }
+
+       //
+       // Now look the thing inside our children
+       //
+       // FIXME: Dont know how to navigate an object for its children looking for "name"
+}
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);
+}
+