Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_GTK_GLUE_H
00020 #define GNASH_GTK_GLUE_H
00021
00022 #include "gnash.h"
00023
00024 #include <cassert>
00025
00026 #include <gtk/gtk.h>
00027 #if !defined(_WIN32) && !defined(__APPLE__)
00028 #include <gdk/gdkx.h>
00029 #else
00030 #include <gdk/gdk.h>
00031 #endif
00032
00033 namespace gnash
00034 {
00035
00036 class Renderer;
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 , int ) {}
00048 virtual void render() = 0;
00049
00050 virtual void render(int , int , int , int )
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() {};
00075
00076 protected:
00077 GtkWidget *_drawing_area;
00078 };
00079
00080 }
00081
00082
00083 #endif