Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 00003 // 2011 Free Software Foundation, Inc 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 00020 #ifndef SDLSUP_H 00021 #define SDLSUP_H 00022 00023 #ifdef HAVE_CONFIG_H 00024 #include "gnashconfig.h" 00025 #endif 00026 00027 #include "gui.h" 00028 00029 #include "SDL.h" 00030 #include "SDL_thread.h" 00031 00032 #ifdef RENDERER_AGG 00033 # include "sdl_agg_glue.h" 00034 #elif defined(RENDERER_CAIRO) 00035 # include "sdl_cairo_glue.h" 00036 #elif defined(RENDERER_OPENGL) 00037 # include "sdl_ogl_glue.h" 00038 #endif 00039 00040 00041 #ifdef RENDERER_CAIRO 00042 # include <cairo.h> 00043 #endif 00044 00045 namespace gnash 00046 { 00047 00048 class SDLGui : public Gui 00049 { 00050 public: 00051 SDLGui(unsigned long xid, float scale, bool loop, RunResources& r); 00052 virtual ~SDLGui(); 00053 virtual bool init(int argc, char **argv[]); 00054 virtual bool createWindow(const char *title, int width, int height, 00055 int xPosition = 0, int yPosition = 0); 00056 virtual bool run(); 00057 virtual bool createMenu(); 00058 virtual bool setupEvents(); 00059 virtual void renderBuffer(); 00060 virtual void setInterval(unsigned int interval); 00061 virtual void disableCoreTrap(); 00062 virtual void setTimeout(unsigned int timeout); 00063 00064 void key_event(SDL_KeyboardEvent * key, bool down); 00065 00066 // See gui.h for documentation 00067 void setInvalidatedRegions(const InvalidatedRanges& ranges); 00068 00069 private: 00070 unsigned int _timeout; 00071 bool _core_trap; 00072 00074 void resize_event(); 00075 00077 void expose_event(); 00078 00079 static key::code sdl_to_gnash_key(SDL_KeyboardEvent* key); 00080 static int sdl_to_gnash_modifier(int state); 00081 00082 #ifdef RENDERER_AGG 00083 SdlAggGlue _glue; 00084 #elif defined(RENDERER_CAIRO) 00085 SdlCairoGlue _glue; 00086 #elif defined(RENDERER_OPENGL) 00087 SdlOglGlue _glue; 00088 #endif 00089 00090 }; 00091 00092 // void xt_event_handler(Widget xtwidget, gpointer instance, 00093 // XEvent *xevent, Boolean *b); 00094 00095 // end of namespace gnash 00096 } 00097 00098 // end of __SDLSUP_H__ 00099 #endif