gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/avm2 r9560: Add addChild method to Display


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9560: Add addChild method to DisplayObjectContainerClass.
Date: Fri, 12 Sep 2008 20:09:40 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9560
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Fri 2008-09-12 20:09:40 +0800
message:
  Add addChild method to DisplayObjectContainerClass.
modified:
  libcore/asobj/flash/display/DisplayObjectContainer_as.cpp
  libcore/asobj/flash/display/DisplayObjectContainer_as.h
  libcore/asobj/flash/display/DisplayObject_as.cpp
  libcore/asobj/flash/display/DisplayObject_as.h
=== modified file 'libcore/asobj/flash/display/DisplayObjectContainer_as.cpp'
--- a/libcore/asobj/flash/display/DisplayObjectContainer_as.cpp 2008-09-06 
15:57:32 +0000
+++ b/libcore/asobj/flash/display/DisplayObjectContainer_as.cpp 2008-09-12 
12:09:40 +0000
@@ -22,6 +22,7 @@
 #include "as_object.h" // for inheritance
 #include "builtin_function.h" // need builtin_function
 #include "flash/display/InteractiveObject_as.h"
+#include "flash/display/DisplayObjectContainer_as.h"
 
 #include "log.h"
 
@@ -29,18 +30,35 @@
 #include <sstream>
 
 namespace gnash {
-class display_object_container_as_object : public as_object
-{
-
-public:
-
-       display_object_container_as_object()
-               :
-               as_object()
-       {
-       }
-
-};
+
+static as_value DisplayObjectContainer_addChild(const fn_call& fn);
+
+static void
+attachDisplayObjectContainerInterface(as_object& o)
+{
+        o.init_member("addChild", new 
builtin_function(DisplayObjectContainer_addChild));
+}
+
+
+display_object_container_as_object::display_object_container_as_object()
+       :
+       as_object()
+{
+}
+
+as_value
+display_object_container_as_object::addChild(as_value child){
+
+               return child;
+}
+
+static as_value DisplayObjectContainer_addChild(const fn_call& fn){
+       
+       boost::intrusive_ptr<display_object_container_as_object> ptr = 
ensureType<display_object_container_as_object>(fn.this_ptr);
+
+       return ptr->addChild(fn.arg(0));
+
+}
 
 static as_value
 display_object_container_ctor(const fn_call& fn)
@@ -58,6 +76,8 @@
        {
                o = new as_object(getInteractiveObjectInterface());
        }
+       attachDisplayObjectContainerInterface(*o);
+       o.get()->dump_members();
        return o.get();
 }
 

=== modified file 'libcore/asobj/flash/display/DisplayObjectContainer_as.h'
--- a/libcore/asobj/flash/display/DisplayObjectContainer_as.h   2008-09-06 
15:57:32 +0000
+++ b/libcore/asobj/flash/display/DisplayObjectContainer_as.h   2008-09-12 
12:09:40 +0000
@@ -25,11 +25,25 @@
 #define GNASH_DISPLAYOBJECTCONTAINER_H
 
 #include <memory> // for auto_ptr
+#include "flash/display/DisplayObject_as.h"
 
 namespace gnash {
 
 class as_object;
 
+class display_object_container_as_object: public as_object
+{
+
+public:
+
+       display_object_container_as_object();
+
+       as_value addChild(as_value child);
+
+private:
+
+};
+
 /// Initialize the DisplayObjectContainer class
 void display_object_container_class_init(as_object& where);
 

=== modified file 'libcore/asobj/flash/display/DisplayObject_as.cpp'
--- a/libcore/asobj/flash/display/DisplayObject_as.cpp  2008-09-06 15:57:32 
+0000
+++ b/libcore/asobj/flash/display/DisplayObject_as.cpp  2008-09-12 12:09:40 
+0000
@@ -22,6 +22,7 @@
 #include "as_object.h" // for inheritance
 #include "builtin_function.h" // need builtin_function
 #include "flash/events/EventDispatcher_as.h"
+#include "flash/display/DisplayObject_as.h"
 
 #include "log.h"
 
@@ -29,18 +30,6 @@
 #include <sstream>
 
 namespace gnash {
-class display_object_as_object : public as_object
-{
-
-public:
-
-       display_object_as_object()
-               :
-               as_object()
-       {
-       }
-
-};
 
 static as_value
 display_object_ctor(const fn_call& fn)

=== modified file 'libcore/asobj/flash/display/DisplayObject_as.h'
--- a/libcore/asobj/flash/display/DisplayObject_as.h    2008-09-06 15:57:32 
+0000
+++ b/libcore/asobj/flash/display/DisplayObject_as.h    2008-09-12 12:09:40 
+0000
@@ -30,6 +30,19 @@
 
 class as_object;
 
+class display_object_as_object : public as_object
+{
+
+public:
+
+       display_object_as_object()
+               :
+               as_object()
+       {
+       }
+
+};
+
 /// Initialize the DisplayObject class
 void display_object_class_init(as_object& where);
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]