00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029 #ifndef __TEXT_H__
00030 #define __TEXT_H__
00031
00032 #include "X3DGeometryNode.h"
00033 #include "X3DFontStyleNode.h"
00034 #include "MFFloat.h"
00035 #include "SFFloat.h"
00036 #include "MFString.h"
00037
00038 namespace H3D {
00039
00082 class H3DAPI_API Text : public X3DGeometryNode {
00083 protected:
00084 typedef TypedSFNode< X3DFontStyleNode > SFFontStyleNode;
00085
00093 class H3DAPI_API SFBound:
00094 public TypedField< X3DGeometryNode::SFBound,
00095 Types< SFFontStyleNode, MFFloat, SFFloat, MFString > >{
00096 protected:
00098 virtual void update();
00099 };
00100
00108 class H3DAPI_API DisplayList : public X3DGeometryNode::DisplayList {
00111 virtual void callList( bool build_list );
00112 };
00113
00114 public:
00115
00117 Text( Inst< SFNode > _metadata = 0,
00118 Inst< SFBound > _bound = 0,
00119 Inst< DisplayList > _displayList = 0,
00120 Inst< SFFontStyleNode > _fontStyle = 0,
00121 Inst< MFFloat > _length = 0,
00122 Inst< SFFloat > _maxExtent = 0,
00123 Inst< MFString > _string = 0,
00124 Inst< SFBool > _solid = 0 );
00125
00127 virtual void render();
00128
00129 #ifdef USE_HAPTICS
00132 virtual void traverseSG( TraverseInfo &ti );
00133 #endif
00134
00140 auto_ptr< SFFontStyleNode > fontStyle;
00141
00157 auto_ptr< MFFloat > length;
00158
00173 auto_ptr< SFFloat > maxExtent;
00174
00180 auto_ptr< MFString > stringF;
00181
00189 auto_ptr< SFBool > solid;
00190
00192 static H3DNodeDatabase database;
00193 protected:
00198 virtual void scaleToMaxExtent( const vector< string >&text,
00199 X3DFontStyleNode *font );
00200
00203 virtual void justifyMinor( const vector< string > &text,
00204 X3DFontStyleNode *font );
00205
00210 virtual void moveToNewLine( const string &text, X3DFontStyleNode *font );
00211
00214 virtual void renderTextLine( const string& text,
00215 X3DFontStyleNode *font );
00216
00219 virtual void justifyLine( const string& text,
00220 X3DFontStyleNode *font );
00221 };
00222 }
00223
00224 #endif