glview.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * gcu/glview.h 
00006  *
00007  * Copyright (C) 2006 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_GL_VIEW_H
00026 #define GCU_GL_VIEW_H
00027 
00028 #include "macros.h"
00029 #include "matrix.h"
00030 #include <gtk/gtkwidget.h>
00031 #include <libgnomeprint/gnome-print.h>
00032 #include <map>
00033 
00034 extern double DefaultPsi, DefaultTheta, DefaultPhi;
00035 
00036 using namespace std;
00037 
00038 namespace gcu {
00039 
00040 class GLDocument;
00041 
00042 class GLView
00043 {
00044 public:
00046 
00051         GLView (GLDocument* pDoc);
00053 
00056         virtual ~GLView ();
00057 
00058         GtkWidget *GetWidget () {return m_pWidget;}
00062         void Init ();
00066         void Reshape ();
00070         void Draw ();
00077         bool OnPressed (GdkEventButton *event);
00086         bool OnMotion (GdkEventMotion *event);
00091         void Update ();
00092         void SetRotation (double psi, double theta, double phi);
00093         void Print (GnomePrintContext *pc, gdouble width, gdouble height);
00104         void SaveAsImage (string const &filename, char const *type, map<string, string>& options, int resolution = 0);
00105 
00106 private:
00113         void Rotate (gdouble x, gdouble y);
00114 
00115 protected:
00116         GtkWidget *m_pWidget;
00117         unsigned m_nGLList;
00118 
00119 private:
00120         bool m_bInit;
00121         Matrix m_Euler;
00122         double m_Height, m_Width, m_Near, m_Far;
00123         double m_Lastx, m_Lasty;
00124 
00125 // Properties
00126 GCU_PROP (double, Angle)
00127 GCU_PROP (double, Psi)
00128 GCU_PROP (double, Phi)
00129 GCU_PROP (double, Theta)
00130 GCU_PROP (float, Red)
00131 GCU_PROP (float, Green)
00132 GCU_PROP (float, Blue)
00133 GCU_PROP (float, Alpha)
00134 GCU_RO_PROP (GLDocument *, Doc)
00135 GCU_PROT_PROP (double, Radius);
00136 };
00137 
00138 }       // namespace gcu
00139 
00140 #endif  //      GCU_GL_VIEW_H

Generated on Sun Nov 26 11:43:07 2006 for The Gnome Chemistry Utils by  doxygen 1.5.1