Gnash  0.8.11dev
sdlsup.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 // 2011 Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 
20 #ifndef SDLSUP_H
21 #define SDLSUP_H
22 
23 #ifdef HAVE_CONFIG_H
24 #include "gnashconfig.h"
25 #endif
26 
27 #include "gui.h"
28 
29 #include "SDL.h"
30 #include "SDL_thread.h"
31 
32 #ifdef RENDERER_AGG
33 # include "sdl_agg_glue.h"
34 #elif defined(RENDERER_CAIRO)
35 # include "sdl_cairo_glue.h"
36 #elif defined(RENDERER_OPENGL)
37 # include "sdl_ogl_glue.h"
38 #endif
39 
40 
41 #ifdef RENDERER_CAIRO
42 # include <cairo.h>
43 #endif
44 
45 namespace gnash
46 {
47 
48 class SDLGui : public Gui
49 {
50 public:
51  SDLGui(unsigned long xid, float scale, bool loop, RunResources& r);
52  virtual ~SDLGui();
53  virtual bool init(int argc, char **argv[]);
54  virtual bool createWindow(const char *title, int width, int height,
55  int xPosition = 0, int yPosition = 0);
56  virtual bool run();
57  virtual bool createMenu();
58  virtual bool setupEvents();
59  virtual void renderBuffer();
60  virtual void setInterval(unsigned int interval);
61  virtual void disableCoreTrap();
62  virtual void setTimeout(unsigned int timeout);
63 
64  void key_event(SDL_KeyboardEvent * key, bool down);
65 
66  // See gui.h for documentation
67  void setInvalidatedRegions(const InvalidatedRanges& ranges);
68 
69 private:
70  unsigned int _timeout;
71  bool _core_trap;
72 
74  void resize_event();
75 
77  void expose_event();
78 
79  static key::code sdl_to_gnash_key(SDL_KeyboardEvent* key);
80  static int sdl_to_gnash_modifier(int state);
81 
82 #ifdef RENDERER_AGG
83  SdlAggGlue _glue;
84 #elif defined(RENDERER_CAIRO)
85  SdlCairoGlue _glue;
86 #elif defined(RENDERER_OPENGL)
87  SdlOglGlue _glue;
88 #endif
89 
90 };
91 
92 // void xt_event_handler(Widget xtwidget, gpointer instance,
93 // XEvent *xevent, Boolean *b);
94 
95 // end of namespace gnash
96 }
97 
98 // end of __SDLSUP_H__
99 #endif
virtual void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: sdl.cpp:219
Definition: sdl_cairo_glue.h:32
virtual void setTimeout(unsigned int timeout)
Set the time in milliseconds after which the programme should exit.
Definition: sdl.cpp:135
Definition: sdl_ogl_glue.h:25
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Definition: sdl_agg_glue.h:28
Definition: klash_part.cpp:329
virtual bool setupEvents()
Definition: sdl.cpp:231
code
Definition: GnashKey.h:43
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
Definition: GnashKey.h:164
Definition: klash_part.cpp:329
virtual bool createWindow(const char *title, int width, int height, int xPosition=0, int yPosition=0)
Create and display our window.
Definition: sdl.cpp:174
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
SDLGui(unsigned long xid, float scale, bool loop, RunResources &r)
Definition: sdl.cpp:37
virtual bool createMenu()
Definition: sdl.cpp:225
void key_event(SDL_KeyboardEvent *key, bool down)
Definition: sdl.cpp:294
virtual ~SDLGui()
Definition: sdl.cpp:44
virtual void disableCoreTrap()
Definition: sdl.cpp:200
Definition: sdlsup.h:48
virtual void renderBuffer()
Definition: sdl.cpp:213
void setInvalidatedRegions(const InvalidatedRanges &ranges)
Definition: sdl.cpp:207
virtual bool run()
Start main rendering loop.
Definition: sdl.cpp:49
virtual bool init(int argc, char **argv[])
/ Initialise the gui and the associated renderer.
Definition: sdl.cpp:141