00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OSGVIEWER_GRAPHICSWINDOWGTK_H
00020 #define OSGVIEWER_GRAPHICSWINDOWGTK_H
00021
00022 #include <gtk/gtkwidget.h>
00023 #include <gtk/gtkgl.h>
00024 #include <osgViewer/GraphicsWindow>
00025
00026 namespace osgViewer
00027 {
00036 class GraphicsWindowGtk: public osgViewer::GraphicsWindow
00037 {
00038 public:
00039
00041 GraphicsWindowGtk(int width, int height, int mode=GDK_GL_MODE_RGB|GDK_GL_MODE_DEPTH|GDK_GL_MODE_DOUBLE);
00042
00043 virtual ~GraphicsWindowGtk();
00044
00045 virtual bool isSameKindAs(const osg::Object* object) const;
00046
00047 virtual const char* libraryName() const;
00048
00049 virtual const char* className() const;
00050
00052 GtkWidget* gtk_widget();
00053
00055 operator GtkWidget*() { return m_gtk_widget; }
00056
00058 virtual void grabFocus();
00059
00061 virtual void grabFocusIfPointerInWindow();
00062
00064 virtual bool valid() const;
00065
00067 virtual bool setWindowRectangleImplementation(int x, int y, int width, int height);
00068
00070 virtual void setCursor(MouseCursor mouseCursor);
00071
00073 virtual bool setWindowDecorationImplementation(bool flag);
00074
00076 virtual void setWindowName(const std::string& name);
00077
00079 virtual bool realizeImplementation();
00080
00082 virtual bool isRealizedImplementation() const;
00083
00085 virtual bool makeCurrentImplementation();
00086
00088 virtual bool releaseContextImplementation();
00089
00091 virtual void closeImplementation();
00092
00094 virtual void swapBuffersImplementation();
00095
00100 bool swap_buffers();
00101
00103 bool gl_begin();
00104
00106 bool gl_end();
00107
00108 protected:
00109 GtkWidget* m_gtk_widget;
00110 GdkGLConfig* m_gdk_gl_config;
00111
00112 static gboolean on_button_event(GtkWidget* widget, GdkEventButton* event, gpointer user_data);
00113
00114 static gboolean on_configure_event(GtkWidget* widget, GdkEventConfigure* event, gpointer user_data);
00115
00116 static gboolean on_key_event(GtkWidget* widget, GdkEventKey* event, gpointer user_data);
00117
00118 static gboolean on_motion_notify_event(GtkWidget* widget, GdkEventMotion* event, gpointer user_data);
00119
00120 static gboolean on_proximity_event(GtkWidget* widget, GdkEventProximity* event, gpointer user_data);
00121
00122 static gboolean on_scroll_event(GtkWidget* widget, GdkEventScroll* event, gpointer user_data);
00123
00124 void transform_mouse_x_y( double& x, double& y );
00125 };
00126
00127 }
00128
00129 #endif