action.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
00003 // 
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 2 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00016 
00017 // 
00018 //
00019 //
00020 
00021 // Implementation and helpers for SWF actions.
00022 
00023 
00024 #ifndef GNASH_ACTION_H
00025 #define GNASH_ACTION_H
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #include "config.h"
00029 #endif
00030 
00031 #include "tu_config.h"
00032 
00033 #include "gnash.h"
00034 #include "as_object.h"
00035 #include "types.h"
00036 #include "container.h"
00037 #include "smart_ptr.h"
00038 
00039 #include <cwchar>
00040 
00041 
00042 namespace gnash {
00043         class sprite_instance;
00044         class as_environment;
00045         class as_object;
00046         class as_value;
00047         class swf_function;
00048 
00049 
00050         extern DSOEXPORT boost::intrusive_ptr<as_object> s_global;
00051 
00052         class DSOLOCAL as_property_interface
00053         {
00054         public:
00055                 virtual ~as_property_interface() {}
00056                 virtual bool    set_property(int index, const as_value& val) = 0;
00057         };
00058 
00059         //
00060         // Some handy helpers
00061         //
00062 
00064         DSOEXPORT void  action_init();
00065 
00066         // Clean up any stray heap stuff we've allocated.
00067         void    action_clear();
00068 
00069         // Dispatching methods from C++.
00070         as_value        call_method0(const as_value& method, as_environment* env, as_object* this_ptr);
00071         as_value        call_method1(
00072                 const as_value& method, as_environment* env, as_object* this_ptr,
00073                 const as_value& arg0);
00074         as_value        call_method2(
00075                 const as_value& method, as_environment* env, as_object* this_ptr,
00076                 const as_value& arg0, const as_value& arg1);
00077         as_value        call_method3(
00078                 const as_value& method, as_environment* env, as_object* this_ptr,
00079                 const as_value& arg0, const as_value& arg1, const as_value& arg2);
00080 
00082         //
00091         DSOEXPORT as_value call_method(const as_value& method, as_environment* env,
00092                 as_object* this_ptr, // this is ourself
00093                 int nargs, int first_arg_bottom_index);
00094 
00095         const char*     call_method_parsed(
00096                 as_environment* env,
00097                 as_object* this_ptr,
00098                 const char* method_name,
00099                 const char* method_arg_fmt,
00100                 va_list args);
00101 
00102         // tulrich: don't use this!  To register a class constructor,
00103         // just assign the classname to the constructor function.  E.g.:
00104         //
00105         // my_movie->set_member("MyClass", as_value(MyClassConstructorFunction));
00106         // 
00107         //void register_as_object(const char* object_name, as_c_function_ptr handler);
00108 
00112         enum as_standard_member
00113         {
00114                 M_INVALID_MEMBER = -1,
00115                 M_X,
00116                 M_Y,
00117                 M_XSCALE,
00118                 M_YSCALE,
00119                 M_CURRENTFRAME,
00120                 M_TOTALFRAMES,
00121                 M_ALPHA,
00122                 M_VISIBLE,
00123                 M_WIDTH,
00124                 M_HEIGHT,
00125                 M_ROTATION,
00126                 M_TARGET,
00127                 M_FRAMESLOADED,
00128                 M_NAME,
00129                 M_DROPTARGET,
00130                 M_URL,
00131                 M_HIGHQUALITY,
00132                 M_FOCUSRECT,
00133                 M_SOUNDBUFTIME,
00134                 M_XMOUSE,
00135                 M_YMOUSE,
00136                 M_PARENT,
00137                 M_TEXT,
00138                 M_TEXTWIDTH,
00139                 M_TEXTCOLOR,
00140                 M_ONLOAD,
00141                 M_ONROLLOVER,
00142                 M_ONROLLOUT,
00143 
00144                 AS_STANDARD_MEMBER_COUNT
00145         };
00146 
00149         as_standard_member      get_standard_member(const tu_stringi& name);
00150 
00151         void attach_extern_movie(const char* c_url, const sprite_instance* target, const sprite_instance* root_movie);
00152 
00153 }       // end namespace gnash
00154 
00155 
00156 #endif // GNASH_ACTION_H
00157 
00158 
00159 // Local Variables:
00160 // mode: C++
00161 // indent-tabs-mode: t
00162 // End:

Generated on Thu Nov 23 22:31:30 2006 for Gnash by  doxygen 1.4.6