00001
00002
00003
00004
00005
00006
00007
00008 #ifndef Word_Header
00009 #define Word_Header
00010
00011 #include <G3DAll.h>
00012 #include <string>
00013 #include <XercesXMLUtil.H>
00014 #include <IS3D.H>
00015 #include "NiceText.H"
00016
00017 using namespace std;
00018
00019 namespace cavewriting {
00020
00021 class Section;
00022
00023 class Word {
00024
00025 public:
00026 Word(xercesc::DOMNode* node, int id, Section* section, int indexInSection, bool visible=true);
00027 Word(string text);
00028 virtual ~Word();
00029
00030 const string& getText() { return _text; }
00031 NiceTextRef getNiceText() { return _niceText; }
00032 double getWidth() { return _niceText->getWidth(); }
00033
00034 void show();
00035 void hide();
00036
00037 void markPeeled() { _peeled = true; }
00038 void markReplaced() { _peeled = false; }
00039 bool isPeeled() { return _peeled; }
00040 void playPeelSound();
00041 void playBounceSound();
00042 void playBreakSound();
00043
00044 void setSection(Section* section);
00045 Section* getSection() { return _section; }
00046
00047 double getWeight() { return _weight; }
00048
00049 bool getCollapsed() { return _collapsed; }
00050 void setCollapsed(bool col) { _collapsed = col; }
00051
00052
00053
00054 Word* breakApart();
00055
00056 CoordinateFrame getFrameInSection() { return _frameInSection; }
00057 void setFrameInSection(CoordinateFrame frame) { _frameInSection = frame; }
00058 void resetSyllableBreak();
00059
00060 private:
00061 Section* _section;
00062 int _id;
00063 Array<xercesc::DOMNode*> _fragments;
00064 string _text;
00065 NiceTextRef _niceText;
00066 double _weight;
00067 bool _visible;
00068 bool _peeled;
00069 int _syllableBreak;
00070 string _soundName;
00071
00072
00073 CoordinateFrame _frameInSection;
00075 bool _collapsed;
00076
00077 void buildDrawObj();
00078 };
00079 }
00080
00081 #endif