00001 #ifndef X11_WINDOW_H 00002 #define X11_WINDOW_H 00003 00004 #include "mimasconfig.h" 00005 00006 #ifdef HAVE_OPENGL 00007 00008 #include <boost/shared_ptr.hpp> 00009 #define GLX_GLXEXT_PROTOTYPES 00010 #include <GL/glx.h> 00011 #include <map> 00012 #include <X11/Xlib.h> 00013 #include <X11/Xutil.h> 00014 #include "object.h" 00015 #include "mimasexception.h" 00016 00017 namespace mimas { 00018 00019 class x11_display; 00020 00024 class x11_window: public object 00025 { 00026 friend class x11_display; 00027 public: 00029 x11_window( x11_display *_display, int _width, int _height, 00030 bool depthBuffer = false ); 00032 virtual ~x11_window(void); 00034 int get_width(void) const { return width; } 00036 int get_height(void) const { return height; } 00038 void set_title( const char *_title ); 00040 XVisualInfo *get_visual_info(void) const { return visualInfo; } 00042 x11_display *get_display(void) { return display; } 00044 Window get_window(void) { return window; } 00046 void resize( int _width, int _height ) throw (mimasexception); 00048 void repaint(void); 00049 protected: 00053 virtual void handle_event( XEvent &event ) throw (mimasexception); 00055 virtual void paint_event(void) throw (mimasexception) = 0; 00057 virtual void key_event( XKeyEvent &xkey ) throw (mimasexception); 00059 static Bool waitForNotify( Display *, XEvent *e, char *arg ); 00061 x11_display *display; 00063 XVisualInfo *visualInfo; 00065 Colormap colorMap; 00067 Window window; 00069 int width; 00071 int height; 00072 }; 00073 00075 typedef boost::shared_ptr< x11_window > x11_window_ptr; 00076 00077 }; 00078 00079 #endif 00080 00081 #endif 00082