gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11041: Migrated ContextMenu to new


From: Jon Crider
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11041: Migrated ContextMenu to new flash Heirarchy
Date: Mon, 08 Jun 2009 16:05:50 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11041
committer: Jon Crider <address@hidden>
branch nick: trunk
timestamp: Mon 2009-06-08 16:05:50 -0600
message:
  Migrated ContextMenu to new flash Heirarchy
removed:
  libcore/asobj/ContextMenu.cpp
  libcore/asobj/ContextMenu.h
modified:
  libcore/ClassHierarchy.cpp
  libcore/asobj/Global.cpp
  libcore/asobj/Makefile.am
  libcore/asobj/flash.am
  libcore/asobj/flash/ui/ContextMenu_as.cpp
  libcore/asobj/flash/ui/ui.am
    ------------------------------------------------------------
    revno: 11039.2.1
    committer: Jon Crider <address@hidden>
    branch nick: srcmv1
    timestamp: Mon 2009-06-08 15:26:30 -0600
    message:
      Moved ContextMenu source code into the new as3 flash heirarchy
    removed:
      libcore/asobj/ContextMenu.cpp
      libcore/asobj/ContextMenu.h
    modified:
      libcore/asobj/Global.cpp
      libcore/asobj/Makefile.am
      libcore/asobj/flash.am
      libcore/asobj/flash/ui/ContextMenu_as.cpp
      libcore/asobj/flash/ui/ui.am
=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp        2009-06-08 18:31:05 +0000
+++ b/libcore/ClassHierarchy.cpp        2009-06-08 22:05:50 +0000
@@ -26,7 +26,7 @@
 #include "Boolean_as.h"
 #include "Camera.h"
 #include "Color_as.h"
-#include "ContextMenu.h"
+#include "flash/ui/ContextMenu_as.h"
 #include "CustomActions.h"
 #include "Date_as.h"
 #include "Error_as.h"

=== removed file 'libcore/asobj/ContextMenu.cpp'
--- a/libcore/asobj/ContextMenu.cpp     2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/ContextMenu.cpp     1970-01-01 00:00:00 +0000
@@ -1,191 +0,0 @@
-// ContextMenu.cpp:  ActionScript ContextMenu class, for Gnash.
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include "ContextMenu.h"
-#include "as_object.h" // for inheritance
-#include "log.h"
-#include "fn_call.h"
-#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-#include "GnashException.h"
-#include "Object.h" // for getObjectInterface
-#include "namedStrings.h"
-#include "utility.h" // UNUSED
-
-namespace gnash {
-
-class ContextMenu: public as_object
-{
-
-public:
-
-       ContextMenu()
-               :
-               as_object(getExportedInterface())
-       {}
-
-       ContextMenu(const as_value& callback)
-               :
-               as_object(getExportedInterface())
-       {
-               setCallback(callback);
-       }
-
-       ContextMenu(as_function* callback)
-               :
-               as_object(getExportedInterface())
-       {
-               setCallback(callback);
-       }
-
-       static void registerConstructor(as_object& global);
-
-       // override from as_object ?
-       //std::string get_text_value() const { return "ContextMenu"; }
-
-       // override from as_object ?
-       //double get_numeric_value() const { return 0; }
-
-private:
-
-       /// Get the callback to call when user invokes the context menu.
-       //
-       /// If NULL, no action will be taken on select.
-       ///
-       as_function* getCallback() 
-       {
-               as_value tmp;
-               if (get_member(NSV::PROP_ON_SELECT, &tmp))
-                       return tmp.to_as_function();
-               else return NULL;
-       }
-
-       /// Set the callback to call when user invokes the context menu.
-       //
-       /// @param callback
-       ///     The function to call. If the value is not a function, no
-       ///     action will be taken on select.
-       ///
-       void setCallback(const as_value& callback)
-       {
-               set_member(NSV::PROP_ON_SELECT, callback);
-       }
-
-       /// Attach the exported interface of this ActionScript class
-       /// to the given object.
-       static void attachExportedInterface(as_object& o);
-
-       /// Get the ContextMenu.prototype ActionScript object
-       static as_object* getExportedInterface();
-
-       static as_value ctor_method(const fn_call& fn);
-
-       static as_value hideBuiltInItems_method(const fn_call& fn);
-
-       static as_value copy_method(const fn_call& fn);
-};
-
-/* static private */
-void
-ContextMenu::attachExportedInterface(as_object& o)
-{
-       o.init_member("copy", new builtin_function(ContextMenu::copy_method));
-       o.init_member("hideBuiltInItems", new 
builtin_function(ContextMenu::hideBuiltInItems_method));
-}
-
-/* static private */
-as_object*
-ContextMenu::getExportedInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-       if ( ! o )
-       {
-               o = new as_object(getObjectInterface());
-               attachExportedInterface(*o);
-       }
-       return o.get();
-}
-
-
-/* static private */
-as_value
-ContextMenu::copy_method(const fn_call& fn)
-{
-       boost::intrusive_ptr<ContextMenu> ptr = 
ensureType<ContextMenu>(fn.this_ptr);
-       UNUSED(ptr);
-       log_unimpl (__FUNCTION__);
-       return as_value();
-}
-
-/* static private */
-as_value
-ContextMenu::hideBuiltInItems_method(const fn_call& fn)
-{
-       boost::intrusive_ptr<ContextMenu> ptr = 
ensureType<ContextMenu>(fn.this_ptr);
-       UNUSED(ptr);
-       log_unimpl (__FUNCTION__);
-       return as_value();
-}
-
-/* static private */
-as_value
-ContextMenu::ctor_method(const fn_call& fn)
-{
-       boost::intrusive_ptr<as_object> obj;
-       if ( fn.nargs > 0 )
-                       obj = new ContextMenu(fn.arg(0));
-       else
-               obj = new ContextMenu();
-       
-       return as_value(obj.get()); // will keep alive
-}
-
-/* static public */
-void
-ContextMenu::registerConstructor(as_object& global)
-{
-       // This is going to be the global ContextMenu "class"/"function"
-       static boost::intrusive_ptr<builtin_function> cl;
-
-       if ( cl == NULL )
-       {
-               cl=new builtin_function(ContextMenu::ctor_method, 
ContextMenu::getExportedInterface());
-               // replicate all interface to class, to be able to access
-               // all methods as static functions
-               ContextMenu::attachExportedInterface(*cl);
-                    
-       }
-
-       // Register _global.ContextMenu
-       global.init_member("ContextMenu", cl.get());
-
-}
-
-// extern (used by Global.cpp)
-void contextmenu_class_init(as_object& global)
-{
-       ContextMenu::registerConstructor(global);
-}
-
-
-} // end of gnash namespace

=== removed file 'libcore/asobj/ContextMenu.h'
--- a/libcore/asobj/ContextMenu.h       2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/ContextMenu.h       1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef __GNASH_ASOBJ_CONTEXTMENU_H__
-#define __GNASH_ASOBJ_CONTEXTMENU_H__
-
-#include <memory> // for auto_ptr
-
-namespace gnash {
-
-class as_object;
-
-/// Initialize the global ContextMenu class
-void contextmenu_class_init(as_object& global);
-
-/// Return a ContextMenu instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_contextmenu_instance();
-  
-} // end of gnash namespace
-
-// __GNASH_ASOBJ_CONTEXTMENU_H__
-#endif
-

=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp  2009-06-08 18:31:05 +0000
+++ b/libcore/asobj/Global.cpp  2009-06-08 22:05:50 +0000
@@ -31,7 +31,7 @@
 #include "Boolean_as.h"
 #include "Camera.h"
 #include "Color_as.h"
-#include "ContextMenu.h"
+#include "flash/ui/ContextMenu_as.h"
 #include "CustomActions.h"
 #include "Date_as.h" // for registerDateNative
 #include "Error_as.h"

=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2009-06-08 18:31:05 +0000
+++ b/libcore/asobj/Makefile.am 2009-06-08 22:05:50 +0000
@@ -57,7 +57,6 @@
        Boolean_as.cpp \
        Camera.cpp \
        Color_as.cpp \
-       ContextMenu.cpp \
        CustomActions.cpp\
        Date_as.cpp \
        Error_as.cpp \
@@ -89,7 +88,6 @@
        Boolean_as.h \
        Camera.h \
        Color_as.h      \
-       ContextMenu.h \
        CustomActions.h \
        Date_as.h \
        Error_as.h      \

=== modified file 'libcore/asobj/flash.am'
--- a/libcore/asobj/flash.am    2009-06-08 18:31:05 +0000
+++ b/libcore/asobj/flash.am    2009-06-08 22:05:50 +0000
@@ -31,7 +31,6 @@
        asobj/Boolean_as.cpp \
        asobj/Camera.cpp \
        asobj/Color_as.cpp \
-       asobj/ContextMenu.cpp   \
        asobj/CustomActions.cpp\
        asobj/Date_as.cpp \
        asobj/Error_as.cpp \
@@ -63,7 +62,6 @@
        asobj/Boolean_as.h \
        asobj/Camera.h \
        asobj/Color_as.h        \
-       asobj/ContextMenu.h \
        asobj/CustomActions.h   \
        asobj/Date_as.h \
        asobj/Error_as.h        \

=== modified file 'libcore/asobj/flash/ui/ContextMenu_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-05-28 17:11:56 +0000
+++ b/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-06-08 21:26:30 +0000
@@ -22,11 +22,13 @@
 #endif
 
 #include "ui/ContextMenu_as.h"
+#include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
 #include "smart_ptr.h" // for boost intrusive_ptr
 #include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
+#include "Object.h" // for getObjectInterface
+#include "namedStrings.h"
 
 namespace gnash {
 
@@ -50,6 +52,61 @@
         :
         as_object(getContextMenuInterface())
     {}
+    
+    ContextMenu_as(const as_value& callback)
+               :
+               as_object(getExportedInterface())
+       {
+               setCallback(callback);
+       }
+
+    ContextMenu_as(as_function* callback)
+               :
+               as_object(getExportedInterface())
+       {
+               setCallback(callback);
+       }
+
+       static void registerConstructor(as_object& global);
+
+private:
+
+       /// Get the callback to call when user invokes the context menu.
+       //
+       /// If NULL, no action will be taken on select.
+       ///
+       as_function* getCallback() 
+       {
+               as_value tmp;
+               if (get_member(NSV::PROP_ON_SELECT, &tmp))
+                       return tmp.to_as_function();
+               else return NULL;
+       }
+
+       /// Set the callback to call when user invokes the context menu.
+       //
+       /// @param callback
+       ///     The function to call. If the value is not a function, no
+       ///     action will be taken on select.
+       ///
+       void setCallback(const as_value& callback)
+       {
+               set_member(NSV::PROP_ON_SELECT, callback);
+       }
+
+       /// Attach the exported interface of this ActionScript class
+       /// to the given object.
+       static void attachExportedInterface(as_object& o);
+
+       /// Get the ContextMenu.prototype ActionScript object
+       static as_object* getExportedInterface();
+
+       static as_value ctor_method(const fn_call& fn);
+
+       static as_value hideBuiltInItems_method(const fn_call& fn);
+
+       static as_value copy_method(const fn_call& fn);
+
 };
 
 // extern (used by Global.cpp)

=== modified file 'libcore/asobj/flash/ui/ui.am'
--- a/libcore/asobj/flash/ui/ui.am      2009-06-07 18:12:15 +0000
+++ b/libcore/asobj/flash/ui/ui.am      2009-06-08 21:26:30 +0000
@@ -32,7 +32,7 @@
 
 # FIXME: already exists
 if BUILD_CONTEXTMENU_AS3
-# UI_SOURCES += asobj/flash/ui/ContextMenu_as.cpp
+UI_SOURCES += asobj/flash/ui/ContextMenu_as.cpp
 UI_HEADERS += asobj/flash/ui/ContextMenu_as.h
 endif
 


reply via email to

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