00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the osgGtk library. * 00006 * * 00007 * The osgGtk library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The osgGtk library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef OSGVIEWER_GRAPHICSWINDOWGTKMM_H 00020 #define OSGVIEWER_GRAPHICSWINDOWGTKMM_H 00021 00022 #include <gtkglmm.h> 00023 #include <osgViewer/GraphicsWindow> 00024 00025 namespace osgViewer 00026 { 00035 class GraphicsWindowGtkmm: public Gtk::GL::DrawingArea, public osgViewer::GraphicsWindow 00036 { 00037 public: 00038 00040 GraphicsWindowGtkmm(int width, int height, Gdk::GL::ConfigMode mode=Gdk::GL::MODE_RGB|Gdk::GL::MODE_DEPTH|Gdk::GL::MODE_DOUBLE); 00041 00042 virtual ~GraphicsWindowGtkmm(); 00043 00044 virtual bool isSameKindAs(const osg::Object* object) const; 00045 00046 virtual const char* libraryName() const; 00047 00048 virtual const char* className() const; 00049 00051 virtual void grabFocus(); 00052 00054 virtual void grabFocusIfPointerInWindow(); 00055 00057 virtual bool valid() const; 00058 00060 virtual bool setWindowRectangleImplementation(int x, int y, int width, int height); 00061 00063 virtual void setCursor(MouseCursor mouseCursor); 00064 00066 virtual bool setWindowDecorationImplementation(bool flag); 00067 00069 virtual void setWindowName(const std::string& name); 00070 00072 virtual bool realizeImplementation(); 00073 00075 virtual bool isRealizedImplementation() const; 00076 00078 virtual bool makeCurrentImplementation(); 00079 00081 virtual bool releaseContextImplementation(); 00082 00084 virtual void closeImplementation(); 00085 00087 virtual void swapBuffersImplementation(); 00088 00093 bool swap_buffers(); 00094 00096 bool gl_begin(); 00097 00099 bool gl_end(); 00100 00101 protected: 00102 Glib::RefPtr<Gdk::GL::Config> m_gl_config; 00103 00104 virtual bool on_button_press_event(GdkEventButton* event); 00105 00106 virtual bool on_button_release_event(GdkEventButton* event); 00107 00108 virtual bool on_configure_event(GdkEventConfigure* event); 00109 00110 virtual bool on_key_press_event(GdkEventKey* event); 00111 00112 virtual bool on_key_release_event(GdkEventKey* event); 00113 00114 virtual bool on_motion_notify_event(GdkEventMotion* event); 00115 00116 virtual bool on_proximity_in_event(GdkEventProximity* event); 00117 00118 virtual bool on_proximity_out_event(GdkEventProximity* event); 00119 00120 virtual bool on_scroll_event(GdkEventScroll* event); 00121 00122 void transform_mouse_x_y( double& x, double& y ); 00123 00124 }; 00125 00126 } 00127 00128 #endif