Gnash  0.8.10
fltksup.h
Go to the documentation of this file.
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 #ifndef GNASH_FLTKSUP_H
00020 #define GNASH_FLTKSUP_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025 
00026 
00027 #include "log.h"
00028 #include "gui.h"
00029 
00030 #include <vector>
00031 #include <fltk/Window.h>
00032 #include <fltk/PopupMenu.h>
00033 
00034 #ifdef RENDERER_AGG
00035 # include "fltk_glue_agg.h"
00036 #elif defined(RENDERER_CAIRO)
00037 # include "fltk_glue_cairo.h"
00038 #endif
00039 
00040 namespace gnash
00041 {
00042 
00043 class FltkGui : public fltk::Window, public Gui
00044 {
00045 public:
00046     FltkGui(unsigned long xid, float scale, bool loop, RunResources& r);
00047 
00048     virtual ~FltkGui();
00049     virtual bool init(int argc, char **argv[]);
00050 
00051     virtual void setInterval(unsigned int);
00052     virtual void setTimeout(unsigned int) { }
00053     virtual bool createWindow(const char *title, int width, int height,
00054                               int xPosition = 0, int yPosition = 0);
00055     virtual void renderBuffer();
00056 
00057     virtual bool run();
00058     virtual bool createMenu();
00059     virtual void setCursor(gnash_cursor_type newcursor);
00060     virtual bool setupEvents() { return true;}
00061 
00062     void setInvalidatedRegions(const InvalidatedRanges& ranges);
00063 
00064     void create();
00065     int handle(int event);
00066     void layout();
00067     void addMenuItems();
00068  private:
00069     void handleKey(unsigned key);
00070 
00071     fltk::PopupMenu  *_popup_menu;
00072     float _interval;
00073     unsigned int _menu_height;
00074 
00075     std::vector< geometry::Range2d<int> > _drawbounds_vec;
00076 
00077 #ifdef RENDERER_AGG
00078     FltkAggGlue *_glue;
00079 #elif defined(RENDERER_CAIRO)
00080     FltkCairoGlue* _glue;
00081 #endif
00082 };
00083 
00084 } // end of namespace gnash 
00085 
00086 #endif // end of __FLTKSUP_H__