The Gnome Chemistry Utils
0.13.6
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * gcugtk/glview.h 00006 * 00007 * Copyright (C) 2011 Jean Bréfort <jean.brefort@normalesup.org> 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License as 00011 * published by the Free Software Foundation; either version 2 of the 00012 * License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00022 * USA 00023 */ 00024 00025 #ifndef GCU_GTK_GL_VIEW_H 00026 #define GCU_GTK_GL_VIEW_H 00027 00028 #include "printable.h" 00029 #include <gcu/glview.h> 00030 #include <gtk/gtk.h> 00031 #include <GL/glx.h> 00032 00033 namespace gcugtk { 00034 00040 class GLView: public gcu::GLView, public gcugtk::Printable 00041 { 00042 friend class GLViewPrivate; 00043 public: 00045 00050 GLView (gcu::GLDocument* pDoc) throw (std::runtime_error); 00052 00055 virtual ~GLView (); 00056 00060 GtkWidget *GetWidget () {return m_Widget;} 00061 00065 GtkWindow *GetGtkWindow () {return GTK_WINDOW (gtk_widget_get_toplevel (m_Widget));} 00070 void Update (); 00078 void DoPrint (GtkPrintOperation *print, GtkPrintContext *context, int page) const; 00088 GdkPixbuf *BuildPixbuf (unsigned width, unsigned height, bool use_bg) const; 00089 00090 protected: 00091 virtual bool GLBegin (); 00092 virtual void GLEnd (); 00093 00094 private: 00095 void Reshape (int width, int height) ; 00096 00097 protected: 00101 GtkWidget *m_Widget; 00102 00103 private: 00104 bool m_bInit; 00105 GdkWindow *m_Window; 00106 GLXContext m_Context; 00107 XVisualInfo *m_VisualInfo; 00108 }; 00109 00110 } // namespace gcugtk 00111 00112 #endif // GCU_GTK_GL_VIEW_H