glc_3dwidgetmanagerhandle.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021  *****************************************************************************/
00023 
00024 #ifndef GLC_3DWIDGETMANAGERHANDLE_H_
00025 #define GLC_3DWIDGETMANAGERHANDLE_H_
00026 
00027 #include "../glc_config.h"
00028 #include "../sceneGraph/glc_3dviewcollection.h"
00029 #include "../viewport/glc_viewport.h"
00030 
00031 class GLC_3DVIewInstance;
00032 class GLC_3DWidget;
00033 
00034 class GLC_LIB_EXPORT GLC_3DWidgetManagerHandle
00035 {
00036 
00038 
00040 
00041 public:
00043         GLC_3DWidgetManagerHandle(GLC_Viewport* pViewport);
00044 
00046         ~GLC_3DWidgetManagerHandle();
00048 
00050 
00052 
00053 public:
00055         inline bool isOrphan() const
00056         {return  0 == m_Count;}
00057 
00059         inline GLC_3DViewInstance* instanceHandle(GLC_uint id)
00060         {return m_Collection.instanceHandle(id);}
00061 
00063         inline bool hasAnActiveWidget() const
00064         {return 0 != m_Active3DWidgetId;}
00065 
00067         inline const GLC_Camera* cameraHandle() const
00068         {return m_pViewport->cameraHandle();}
00069 
00071         inline GLC_BoundingBox boundingBox()
00072         {return m_Collection.boundingBox();}
00073 
00075         inline bool useOrtho() const
00076         {return m_pViewport->useOrtho();}
00077 
00079         double viewportTangent() const
00080         {return m_pViewport->viewTangent();}
00081 
00083         inline GLC_Viewport* viewport() const
00084         {return m_pViewport;}
00085 
00087         inline bool contains3DWidget(GLC_uint id) const
00088         {return m_3DWidgetHash.contains(id);}
00089 
00091         inline GLC_3DWidget* widget(GLC_uint id) const
00092         {return m_3DWidgetHash.value(id);}
00093 
00095 
00097 
00099 
00100 public:
00102         inline void increment()
00103         {++m_Count;}
00104 
00106         inline void decrement()
00107         {--m_Count;}
00108 
00110         void add3DWidget(GLC_3DWidget* p3DWidget);
00111 
00113 
00114         void remove3DWidget(GLC_uint id);
00115 
00117 
00118         GLC_3DWidget* take(GLC_uint id);
00119 
00121         void add3DViewInstance(const GLC_3DViewInstance& instance, GLC_uint widgetId);
00122 
00124         void remove3DViewInstance(GLC_uint id);
00125 
00127         void clear();
00128 
00130         void setWidgetVisible(GLC_uint id, bool visible);
00131 
00133 
00134 
00136 
00137 public:
00139         glc::WidgetEventFlag mouseDoubleClickEvent(QMouseEvent * pEvent);
00140 
00142         glc::WidgetEventFlag mouseMoveEvent(QMouseEvent * pEvent);
00143 
00145         glc::WidgetEventFlag mousePressEvent(QMouseEvent * pEvent);
00146 
00148         glc::WidgetEventFlag mouseReleaseEvent(QMouseEvent * pEvent);
00149 
00151 
00153 
00155 
00156 public:
00158         void render();
00159 
00161 
00163 // Private services function
00165 private:
00167         QPair<GLC_uint, GLC_Point3d> select(QMouseEvent* event);
00168 
00170 // Private Member
00172 private:
00174         GLC_3DViewCollection m_Collection;
00175 
00177         int m_Count;
00178 
00180         QHash<GLC_uint, GLC_3DWidget*> m_3DWidgetHash;
00181 
00183         QHash<GLC_uint, GLC_uint> m_MapBetweenInstanceWidget;
00184 
00186         GLC_Viewport* m_pViewport;
00187 
00189         GLC_uint m_Active3DWidgetId;
00190 
00192         GLC_uint m_Preselected3DWidgetId;
00193 };
00194 
00195 #endif /* GLC_3DWIDGETMANAGERHANDLE_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon