Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

crystalview.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalviewer/crystalview.h 
00006  *
00007  * Copyright (C) 2002-2003
00008  *
00009  * Developed by Jean Bréfort <jean.brefort@ac-dijon.fr>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2.1 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the 
00023  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00024  * Boston, MA  02111-1307, USA.
00025  */
00026 
00027 #ifndef CRYSTAL_VIEW_H
00028 #define CRYSTAL_VIEW_H
00029 
00030 #include <libxml/parser.h>
00031 #include <chemistry/matrix.h>
00032 #include <list>
00033 #include <gtk/gtkwidget.h>
00034 
00035 using namespace std;
00036 
00037 namespace gcu
00038 {
00039 class CrystalDoc;
00040         
00046 class CrystalView
00047 {
00048 public:
00050 
00055         CrystalView(CrystalDoc* pDoc);
00057 
00060         virtual ~CrystalView();
00061         
00066         GtkWidget* CreateNewWidget();
00072         void Init(GtkWidget *widget);
00078         void Reshape(GtkWidget *widget);
00084         void Draw(GtkWidget *widget);
00088         void Update();
00094         void Update(GtkWidget *widget);
00101         bool OnPressed(GtkWidget *widget, GdkEventButton *event);
00108         void OnMotion(GtkWidget *widget, GdkEventMotion *event);
00114         void OnDestroyed(GtkWidget *widget);
00115 
00121         virtual bool Load(xmlNodePtr node);
00126         virtual xmlNodePtr Save(xmlDocPtr xml);
00127 
00128 private:
00135         void Rotate(gdouble x, gdouble y);
00136 
00137 protected:
00141         gdouble m_fAngle;
00145         gdouble m_fRadius;
00149         gdouble m_psi;
00153         gdouble m_theta;
00157         gdouble m_phi;
00161         gdouble m_height;
00165         gdouble m_width;
00169         gdouble m_near;
00170 /*
00171 The distance of the back plane delimiting the volume active in the OpenGL representation to the viewer.
00172 */
00173         gdouble m_far;
00177         Matrix m_Euler;
00181         unsigned m_nGLList;
00182         //background color
00186         float m_fBlue;
00190         float m_fRed;
00194         float m_fGreen;
00198         float m_fAlpha;
00202         CrystalDoc* m_pDoc;
00206         GtkWidget* m_pWidget;
00207 
00208 private:
00209         bool m_bInit;
00210         gdouble m_lastx, m_lasty;
00211         list<GtkWidget*> m_Widgets;
00212 };
00213 
00214 } //namespace gcu
00215 
00216 #endif //CRYSTAL_VIEW_H

Generated on Wed Feb 23 13:45:28 2005 for The Gnome Chemistry Utils by  doxygen 1.4.1