Gnash 0.8.10dev
|
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_GTK_GLUE_H 00020 #define GNASH_GTK_GLUE_H 00021 00022 #include <cassert> 00023 00024 #include <gtk/gtk.h> 00025 #if !defined(_WIN32) && !defined(__APPLE__) 00026 #include <gdk/gdkx.h> 00027 #else 00028 #include <gdk/gdk.h> 00029 #endif 00030 00031 namespace gnash { 00032 class Renderer; 00033 class movie_root; 00034 } 00035 00036 namespace gnash { 00037 00038 class GtkGlue 00039 { 00040 public: 00041 GtkGlue() : _drawing_area(0) { } 00042 virtual ~GtkGlue() { } 00043 virtual bool init(int argc, char **argv[]) = 0; 00044 00045 virtual void prepDrawingArea(GtkWidget *drawing_area) = 0; 00046 virtual Renderer* createRenderHandler() = 0; 00047 virtual void setRenderHandlerSize(int /*width*/, int /*height*/) {} 00048 virtual void render() = 0; 00049 00050 virtual void render(int /*minx*/, int /*miny*/, int /*maxx*/, int /*maxy*/) 00051 { 00052 render(); 00053 } 00054 00055 virtual void render(GdkRegion * const region) 00056 { 00057 GdkRectangle* rects; 00058 gint num_rects; 00059 00060 gdk_region_get_rectangles(region, &rects, &num_rects); 00061 assert(num_rects); 00062 00063 for (gint i = 0; i < num_rects; ++i) { 00064 GdkRectangle const & r = rects[i]; 00065 render(r.x, r.y, r.x + r.width, r.y + r.height); 00066 } 00067 00068 g_free(rects); 00069 } 00070 00071 virtual void configure(GtkWidget *const widget, 00072 GdkEventConfigure *const event) = 0; 00073 00074 virtual void beforeRendering(movie_root*) {}; 00075 00076 protected: 00077 GtkWidget *_drawing_area; 00078 }; 00079 00080 } // namespace gnash 00081 00082 // end of GNASH_GTK_GLUE_H 00083 #endif