![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2012 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvOsg/vrvOsg.h> 00013 #include <vrvCore/DtWidget.h> 00014 #include <vrvOsg/DtBaseOutlineAttribute.h> 00015 #include <vrvGraphics/DtBoundingBox.h> 00016 #include <vrvUtil/DtSignalConnectionManager.h> 00017 00018 #include <boost/signals/connection.hpp> 00019 #include <boost/unordered_map.hpp> 00020 00021 #include <osg/Texture> 00022 #include <osg/ref_ptr> 00023 #include <osg/Vec4> 00024 00025 #include <vector> 00026 00027 namespace makVrv 00028 { 00029 00030 class DtDe; 00031 class DtQuad; 00032 class DtAttribute; 00033 00037 class DT_DLL_VRVOSG DtAttributeLayout 00038 { 00039 public: 00040 00042 DtAttributeLayout( DtDe& de ); 00043 00045 virtual ~DtAttributeLayout(); 00046 00048 virtual void setDimensions( unsigned int rows, unsigned int cols ); 00049 00051 virtual void getDimensions( unsigned int& rowsOut, unsigned int& colsOut ); 00052 00057 virtual void setAttribute( 00058 unsigned int row, unsigned int col, DtAttribute* attribute ); 00059 00061 virtual DtAttribute* findAttribute( unsigned int row, unsigned int col ); 00062 00064 virtual void setBottomLeftCorner( double x, double y ); 00065 00067 virtual void setWorldPosition( float x, float y, float z, float w ); 00068 00070 virtual void setBackgroundColor( float r, float g, float b, float a ); 00071 00073 virtual void setBackgroundImage( const std::string& filename ); 00074 00076 virtual void setCellPadding( double colPadding, double rowPadding ); 00077 00079 virtual void updateCellSizes(); 00080 00082 virtual void setVisible( bool visible ); 00083 00085 virtual void setColor( float r, float g, float b, float a ); 00086 00089 virtual void setHorizontalCenter( bool center ); 00090 00093 virtual void setVerticalCenter( bool center ); 00094 00096 virtual void setOverlay( unsigned int overlayId ); 00097 00099 virtual void setOrderGroup( unsigned int group ); 00100 00102 virtual void setWidth( float width ); 00103 00105 virtual void setBackgroundEnabled( bool enabled ); 00106 00108 virtual void setOutlineEnabled( bool enabled ); 00109 00110 protected: 00111 00112 DtDe& myDe; 00113 00114 typedef std::vector<DtAttribute*> Attributes; 00115 typedef std::vector<Attributes> AttributeGrid; 00116 00118 AttributeGrid myAttributeGrid; 00119 00120 bool myHorizontalCenter; 00121 bool myVerticalCenter; 00122 00123 float myWorldX; 00124 float myWorldY; 00125 float myWorldZ; 00126 float myWorldW; 00127 00128 double myOffsetX; 00129 double myOffsetY; 00130 00132 double myXDim; 00133 00135 double myYDim; 00136 00137 double myRowPadding; 00138 double myColumnPadding; 00139 00140 DtQuad* myBackground; 00141 DtBaseOutlineAttribute myOutline; 00142 00143 bool myVisible; 00144 bool myOutlineEnabled; 00145 00146 unsigned int myOverlay; 00147 unsigned int myOverlayGroup; 00148 00149 osg::ref_ptr<osg::Texture> myBackgroundTexture; 00150 osg::Vec4 myBackgroundColor; 00151 DtBoundingBox myBoundingBox; 00152 00154 struct AttributeInfo 00155 { 00156 unsigned int row; 00157 unsigned int col; 00158 boost::signalslib::connection resizeConnection; 00159 }; 00160 00162 typedef boost::unordered_map<DtAttribute*, AttributeInfo> AttributeInfoMap; 00163 AttributeInfoMap myAttributeInfoMap; 00164 00166 virtual void slot_attributeSizeChanged( 00167 DtAttribute* attribute, double xSize, double ySize); 00168 00171 virtual void resizeLayout(); 00172 00175 virtual void redimensionLayout(); 00176 00178 virtual void resizeRowsAndColumns(); 00179 00180 std::vector<double> myColSizes; 00181 std::vector<double> myRowSizes; 00182 00183 private: 00184 00187 void createBackground(); 00188 00193 void eraseAttribute(DtAttribute* attribute); 00194 00195 }; 00196 00197 }