Gnash  0.8.11dev
fltksup.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 #ifndef GNASH_FLTKSUP_H
20 #define GNASH_FLTKSUP_H
21 
22 #ifdef HAVE_CONFIG_H
23 #include "gnashconfig.h"
24 #endif
25 
26 
27 #include "log.h"
28 #include "gui.h"
29 
30 #include <vector>
31 #include <fltk/Window.h>
32 #include <fltk/PopupMenu.h>
33 
34 #ifdef RENDERER_AGG
35 # include "fltk_glue_agg.h"
36 #elif defined(RENDERER_CAIRO)
37 # include "fltk_glue_cairo.h"
38 #endif
39 
40 namespace gnash
41 {
42 
43 class FltkGui : public fltk::Window, public Gui
44 {
45 public:
46  FltkGui(unsigned long xid, float scale, bool loop, RunResources& r);
47 
48  virtual ~FltkGui();
49  virtual bool init(int argc, char **argv[]);
50 
51  virtual void setInterval(unsigned int);
52  virtual void setTimeout(unsigned int) { }
53  virtual bool createWindow(const char *title, int width, int height,
54  int xPosition = 0, int yPosition = 0);
55  virtual void renderBuffer();
56 
57  virtual bool run();
58  virtual bool createMenu();
59  virtual void setCursor(gnash_cursor_type newcursor);
60  virtual bool setupEvents() { return true;}
61 
62  void setInvalidatedRegions(const InvalidatedRanges& ranges);
63 
64  void create();
65  int handle(int event);
66  void layout();
67  void addMenuItems();
68  private:
69  void handleKey(unsigned key);
70 
71  fltk::PopupMenu *_popup_menu;
72  float _interval;
73  unsigned int _menu_height;
74 
75  std::vector< geometry::Range2d<int> > _drawbounds_vec;
76 
77 #ifdef RENDERER_AGG
78  FltkAggGlue *_glue;
79 #elif defined(RENDERER_CAIRO)
80  FltkCairoGlue* _glue;
81 #endif
82 };
83 
84 } // end of namespace gnash
85 
86 #endif // end of __FLTKSUP_H__