2 // Written and (C) by Francois Fleuret
3 // Contact <francois.fleuret@idiap.ch> for comments & bug reports
5 #ifndef SIMPLE_WINDOW_H
6 #define SIMPLE_WINDOW_H
14 #include <X11/Xutil.h>
15 #include <X11/XKBlib.h>
19 #include <cairo-xlib.h>
28 MOUSE_CLICK_PRESS, MOUSE_CLICK_RELEASE,
30 KEY_PRESS, KEY_RELEASE
34 char key[32]; // This is the max length for the pressed key name ('a', 'Alt_L', etc.)
47 int _red_mask, _green_mask, _blue_mask;
48 int _red_shift, _green_shift, _blue_shift;
52 SimpleWindow(const char *name, int x, int y, int w, int h);
53 virtual ~SimpleWindow();
60 virtual void color(float red, float green, float blue);
61 virtual void draw_point(int x, int y);
62 virtual void draw_line(int x1, int y1, int x2, int y2);
63 virtual void draw_circle(int x, int y, int r);
64 virtual void draw_text(const char *s, int x, int y);
65 virtual void fill_rectangle(int x, int y, int w, int h);
66 virtual void fill_polygon(int nb, int *x, int *y);
70 virtual int file_descriptor();
71 virtual SimpleEvent event();
74 virtual cairo_t *get_cairo_context_resource();