gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10860: Add a method to the gtk widg


From: Tomeu Vizoso
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10860: Add a method to the gtk widget for calling an AS method in the movie
Date: Fri, 01 May 2009 19:12:03 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 10860
committer: Tomeu Vizoso <address@hidden>
branch nick: gnash
timestamp: Fri 2009-05-01 19:12:03 +0200
message:
  Add a method to the gtk widget for calling an AS method in the movie
modified:
  gui/pythonmod/gnash-view.cpp
  gui/pythonmod/gnash-view.h
  gui/pythonmod/gnash.defs
=== modified file 'gui/pythonmod/gnash-view.cpp'
--- a/gui/pythonmod/gnash-view.cpp      2009-04-28 18:53:40 +0000
+++ b/gui/pythonmod/gnash-view.cpp      2009-05-01 17:12:03 +0000
@@ -67,6 +67,7 @@
     std::auto_ptr<gnash::RunInfo> run_info;
 
     std::auto_ptr<gnash::movie_definition> movie_definition;
+    boost::intrusive_ptr<gnash::Movie> movie;
     std::auto_ptr<gnash::movie_root> stage;
     std::auto_ptr<gnash::SystemClock> system_clock;
     std::auto_ptr<gnash::InterruptableVirtualClock> virtual_clock;
@@ -102,6 +103,32 @@
     return GTK_WIDGET(g_object_new (GNASH_TYPE_VIEW, NULL));
 }
 
+const gchar *
+gnash_view_call (GnashView *view, const gchar *func_name, const gchar 
*input_data)
+{
+    gnash::VM& vm = view->stage->getVM();
+    gnash::string_table& st = vm.getStringTable();
+       gnash::as_value obj;
+
+    gnash::as_value func = view->movie->getMember(st.find(func_name));
+    if( !func.is_function() ) {
+        return NULL;
+    }
+
+    gnash::as_value result;
+    if( input_data ) {
+        result = view->movie->callMethod(st.find(func_name),
+                                         gnash::as_value(input_data));
+    } else {
+        result = view->movie->callMethod(st.find(func_name));
+    }
+    if( !result.is_string() ) {
+        return NULL;
+    }
+
+    return result.to_string().c_str();
+}
+
 static void
 gnash_view_class_init(GnashViewClass *gnash_view_class)
 {
@@ -445,13 +472,13 @@
 
     gtk_widget_queue_resize (GTK_WIDGET(view));
 
-    std::auto_ptr<gnash::Movie> mr ( view->movie_definition->createMovie() );
+    view->movie.reset ( view->movie_definition->createMovie() );
     
     std::map<std::string, std::string> variables;
     gnash::URL::parse_querystring(url.querystring(), variables);
-    mr->setVariables(variables);
+    view->movie->setVariables(variables);
 
-    view->stage->setRootMovie( mr.release() ); // will construct the instance
+    view->stage->setRootMovie( view->movie.get() ); // will construct the 
instance
 
     view->stage->set_background_alpha(1.0f);
 

=== modified file 'gui/pythonmod/gnash-view.h'
--- a/gui/pythonmod/gnash-view.h        2009-04-26 12:41:35 +0000
+++ b/gui/pythonmod/gnash-view.h        2009-05-01 17:12:03 +0000
@@ -40,6 +40,7 @@
 
 GType        gnash_view_get_type    (void);
 GtkWidget   *gnash_view_new         (void);
+const gchar *gnash_view_call        (GnashView *view, const gchar *func_name, 
const gchar *input_data);
 
 G_END_DECLS
 

=== modified file 'gui/pythonmod/gnash.defs'
--- a/gui/pythonmod/gnash.defs  2009-04-26 12:41:35 +0000
+++ b/gui/pythonmod/gnash.defs  2009-05-01 17:12:03 +0000
@@ -5,3 +5,13 @@
   (gtype-id "GNASH_TYPE_VIEW")
 )
 
+(define-method call
+  (of-object "GnashView")
+  (c-name "gnash_view_call")
+  (return-type "const-char*")
+  (parameters
+    '("const-char*" "func_name")
+    '("const-char*" "input_data" (null-ok) (default "NULL"))
+  )
+)
+


reply via email to

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