vee_value_gui.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 /* COPYRIGHT
00004  *
00005  * This file is part of the Visual Effects Engine - VEE
00006  *
00007  * Read the "VEE-LICENSE" file for the license.
00008  *
00009  * Authors & Copyright:   
00010  *
00011  * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 
00012  * Janne Kontkanen 2001-2004
00013  *
00014  * Additional copyrights: Tekes 2003-2004
00015  *
00016  * firstname.lastname@hut.fi
00017  *
00018  */
00019 
00020 #ifndef VEE_VALUE_GUI_H
00021 #define VEE_VALUE_GUI_H
00022 
00023 #include <vee_parameters.h>
00024 
00025 #include <qwidget.h>
00026 
00027 #include <algorithm>
00028 #include <iterator>
00029 #include <list>
00030 #include <string>
00031 #include <vector>
00032 
00033 class VEE_HasValues;
00034 class VEE_Parameter;
00035 class VEE_ValueGui;
00036 class VEE_ValueGuiFloat;
00037 class VEE_ValueGuiVector3;
00038 
00039 class QGridLayout;
00040 
00041 class VEE_ValueWindow : public QWidget
00042 {
00043 public:
00044   VEE_ValueWindow(QWidget * parent = 0,
00045       const char * name = 0);
00046   virtual ~VEE_ValueWindow();
00047 
00048   QGridLayout *grid() { return m_grid; }
00049 
00050   QWidget *childParent();
00051 
00052   VEE_ValueGui * addParameter(VEE_Parameter *, VEE_HasValues *);
00053 
00054   VEE_ValueGuiFloat * addFloatParameter(const char *,
00055           const char *, VEE_HasValues *,
00056           float v, float rmin, float rmax,
00057           VEE_Mapping m = VEE_MAP_LINEAR);
00058 
00059   VEE_ValueGuiVector3 * addVector3Parameter(const char *,
00060               const char *, VEE_HasValues *,
00061               float xv, float xmin, float xmax,
00062               float yv, float ymin, float ymax,
00063               float zv, float zmin, float zmax);
00064 
00065   void bangValues();
00066 protected:
00067   QGridLayout *m_grid;
00068 
00069   std::list<VEE_ValueGui *> m_guis;
00070 };
00071 
00074 
00075 class VEE_ParamTargets
00076 {
00077 public:
00078   VEE_ParamTargets() {}
00079   ~VEE_ParamTargets() {}
00080 
00081   void clear() { m_targets.clear(); }
00082   void append(VEE_HasValues *target, const char *id)
00083   { 
00084     Internal tmp(target, id);
00085     m_targets.push_back(tmp);
00086   }
00087   void append(VEE_HasValues *target, const std::string & id)
00088   { 
00089     Internal tmp(target, id);
00090     m_targets.push_back(tmp);
00091   }
00092 
00093   void appendMany(VEE_ParamTargets *pt)
00094   {
00095     /*std::copy(m_targets.begin(), m_targets.end(),
00096       std::back_insert_iterator<std::vector<Internal> >
00097       (pt->m_targets));*/
00098     for(uint i=0; i < pt->m_targets.size(); i++)
00099       m_targets.push_back(pt->m_targets[i]);
00100   }
00101 
00102   uint size() const { return m_targets.size(); }
00103   
00104   VEE_HasValues *target(uint i) { return m_targets[i].m_target; }
00105   const std::string & id(uint i) { return m_targets[i].m_id; }
00106 
00107 protected:
00108 
00109   class Internal
00110   {
00111   public:
00112     Internal(VEE_HasValues *target, const char * id) 
00113       : m_target(target), m_id(id ? id : "") {}
00114     
00115     Internal(VEE_HasValues *target, const std::string & id) 
00116       : m_target(target), m_id(id) {}
00117     
00118     VEE_HasValues *m_target;
00119     std::string    m_id;
00120   };
00121 
00122   std::vector<Internal> m_targets;
00123 };
00124 
00127 
00128 class VEE_ValueGui : public QObject
00129 {
00130 public:
00131   VEE_ValueGui(QObject * parent = 0,
00132          const char * name = 0);
00133   
00134   virtual ~VEE_ValueGui();
00135 
00136   virtual void bangValue();
00137 
00138   void addTarget(VEE_HasValues *target, const char * id)
00139   { m_targets.append(target, id); }
00140   void addTargets(VEE_ParamTargets *pt)
00141   { m_targets.appendMany(pt); }
00142   
00143 protected:
00144   VEE_ParamTargets m_targets;
00145 };
00146 
00147 #endif

Generated on Mon Mar 12 21:09:01 2007 for VEE - The Visual Effects Engine by  doxygen 1.4.6