00001
00002
00003
00004
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #ifndef _TEXT_BOX_H_
00019 #define _TEXT_BOX_H_
00020
00021 #include <Medical/InventorMedical.h>
00022
00023 #include <Inventor/nodes/SoAnnotation.h>
00024 #include <Inventor/nodes/SoTextProperty.h>
00025
00026 #include <Inventor/fields/SoSFBool.h>
00027 #include <Inventor/fields/SoSFColor.h>
00028 #include <Inventor/fields/SoSFEnum.h>
00029 #include <Inventor/fields/SoSFFloat.h>
00030 #include <Inventor/fields/SoSFInt32.h>
00031 #include <Inventor/fields/SoSFString.h>
00032 #include <Inventor/fields/SoSFVec3f.h>
00033 #include <Inventor/SbViewportRegion.h>
00034
00035
00036 #include <Inventor/nodes/SoBBox.h>
00037 #include <Inventor/nodes/SoFont.h>
00038 #include <Inventor/nodes/SoLineSet.h>
00039 #include <Inventor/nodes/SoSwitch.h>
00040 #include <Inventor/nodes/SoText2.h>
00041 #include <Inventor/nodes/SoTranslation.h>
00042
00043 class SoNodeSensor;
00044
00107 class INVENTORMEDICAL_API TextBox : public SoAnnotation {
00108
00109 SO_NODE_HEADER(TextBox);
00110
00111 public:
00114 SoSFVec3f position;
00115
00117 SoSFEnum alignmentH;
00118
00120 SoSFEnum alignmentV;
00121
00123 SoSFEnum textAlignH;
00124
00127 SoSFString fontName;
00128
00130 SoSFFloat fontSize;
00131
00133 SoSFBool border;
00134
00136 SoSFColor borderColor;
00137
00139 enum AlignmentH {
00141 LEFT = SoTextProperty::LEFT,
00143 CENTER = SoTextProperty::CENTER,
00145 RIGHT = SoTextProperty::RIGHT,
00146 };
00147
00149 enum AlignmentV {
00151 TOP = SoTextProperty::TOP,
00153 MIDDLE = SoTextProperty::HALF,
00155 BOTTOM = SoTextProperty::BOTTOM,
00156 };
00157
00159 void setLine( const SbString& text, int line = 0 );
00160
00162 const SbString& getLine( int line );
00163
00165 void addLine( const SbString& text );
00166
00172 void deleteLines( int startLine, int numToDelete = 1 );
00173
00175 void deleteAll();
00176
00178 int getNumLines() const;
00179
00181 SoFont* getFontNode();
00182
00184 SoText2* getTextNode();
00185
00187 static void initClass();
00188
00190 static void exitClass();
00191
00193 TextBox();
00194
00195 private:
00197 virtual ~TextBox();
00198
00199 SoRef<SoFont> m_fontNode;
00200 SoRef<SoLineSet> m_borderGeom;
00201 SoRef<SoSwitch> m_fontSwitch;
00202 SoRef<SoSwitch> m_borderSwitch;
00203 SoRef<SoText2> m_textNode;
00204 SoRef<SoTranslation> m_tranNode;
00205 SoRef<SoSeparator> m_textSep;
00206
00207 bool m_isModified;
00208 SbViewportRegion m_curViewport;
00209 SbBox3f m_curBBox;
00210
00211 SoNodeSensor* m_nodeSensor;
00212 static void nodeSensorCB( void* data, SoSensor* sensor );
00213
00214 static void callbackNodeCB( void* data, SoAction* action );
00215
00216 void updatePosAndGeom( SoState* state = NULL );
00217 };
00218
00219 #endif