00001 #ifndef PARTICLEPREVIEW_H_ 00002 #define PARTICLEPREVIEW_H_ 00003 00004 #include "math/matrix.h" 00005 00006 #include <gtk/gtk.h> 00007 #include <igl.h> 00008 #include <string> 00009 #include "../../ufoscript/particles/Particle.h" 00010 00011 namespace ui 00012 { 00017 class ParticlePreview 00018 { 00019 // Top-level widget 00020 GtkWidget* _widget; 00021 00022 // GL widget 00023 GtkWidget* _glWidget; 00024 00025 // Current distance between camera and preview 00026 GLfloat _camDist; 00027 00028 // Current rotation matrix 00029 Matrix4 _rotation; 00030 00031 scripts::IParticlePtr _particle; 00032 00033 private: 00034 00035 /* GTK CALLBACKS */ 00036 00037 static void callbackGLDraw (GtkWidget*, GdkEventExpose*, ParticlePreview*); 00038 static void callbackGLMotion (GtkWidget*, GdkEventMotion*, ParticlePreview*); 00039 static void callbackGLScroll (GtkWidget*, GdkEventScroll*, ParticlePreview*); 00040 static void callbackToggleBBox (GtkToggleToolButton*, ParticlePreview*); 00041 00042 public: 00043 00046 ParticlePreview (); 00047 00050 ~ParticlePreview (); 00051 00057 void setSize (int size); 00058 00062 void initialisePreview (); 00063 00064 void setParticle (scripts::IParticlePtr& particle); 00065 00066 scripts::IParticlePtr getParticle (); 00067 00070 operator GtkWidget* () 00071 { 00072 return _widget; 00073 } 00074 }; 00075 } 00076 00077 #endif /*PARTICLEPREVIEW_H_*/