X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=simple_window.h;h=5981aef929c7e4f22493fa5ad3f866c969f2fc62;hb=804de9eaa678ecf50ab0ed0fbef027fe6dbce414;hp=3761fcd4b5cd7ec73833b138741470470f4a4742;hpb=5c68b9412710739cc0562ab296a9c8af13e9e71c;p=universe.git diff --git a/simple_window.h b/simple_window.h index 3761fcd..5981aef 100644 --- a/simple_window.h +++ b/simple_window.h @@ -1,17 +1,6 @@ -//////////////////////////////////////////////////////////////////////////////// -// This program is free software; you can redistribute it and/or // -// modify it under the terms of the GNU General Public License // -// version 2 as published by the Free Software Foundation. // -// // -// This program is distributed in the hope that it will be useful, but // -// WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// General Public License for more details. // -// // -// Written and (C) by François Fleuret // -// Contact for comments & bug reports // -//////////////////////////////////////////////////////////////////////////////// +// Written and (C) by Francois Fleuret +// Contact for comments & bug reports #ifndef SIMPLE_WINDOW_H #define SIMPLE_WINDOW_H @@ -23,6 +12,12 @@ using namespace std; #include #include +#include + +#ifdef CAIRO_SUPPORT +#include +#include +#endif class SimpleEvent { public: @@ -42,17 +37,24 @@ public: class SimpleWindow { Display *_display; + int _screen; + Visual *_visual; Window _window; Pixmap _pixmap; GC _gc; +#ifdef CAIRO_SUPPORT + cairo_t *_cairo_context; + cairo_surface_t *_cairo_surface; +#endif + protected: int _red_mask, _green_mask, _blue_mask; int _red_shift, _green_shift, _blue_shift; int _width, _height; public: - SimpleWindow(char *name, int x, int y, int w, int h); + SimpleWindow(const char *name, int x, int y, int w, int h); virtual ~SimpleWindow(); virtual int width(); @@ -64,7 +66,7 @@ public: virtual void draw_point(int x, int y); virtual void draw_line(int x1, int y1, int x2, int y2); virtual void draw_circle(int x, int y, int r); - virtual void draw_text(char *s, int x, int y); + virtual void draw_text(const char *s, int x, int y); virtual void fill_rectangle(int x, int y, int w, int h); virtual void fill_polygon(int nb, int *x, int *y); virtual void show(); @@ -72,6 +74,10 @@ public: virtual int file_descriptor(); virtual SimpleEvent event(); + +#ifdef CAIRO_SUPPORT + virtual cairo_t *get_cairo_context_resource(); +#endif }; #endif