00001
00010 #ifndef MULTICOLUMNMENU_H
00011 #define MULTICOLUMNMENU_H
00012
00013 #include "IS3DCommon.H"
00014 #include "DrawObj.H"
00015 #include "Fsa.H"
00016
00017 namespace IS3D {
00018
00019 typedef ReferenceCountedPointer<class MultiColumnMenu> MultiColumnMenuRef;
00027 class MultiColumnMenu : public DrawObj
00028 {
00029 public:
00030
00031 enum ItemState {ENABLED, DISABLED, HIGHLIGHTED, ACTIVATED};
00032
00033
00034 MultiColumnMenu(const std::string &name,
00035 const std::string &title,
00036 Array< Array<std::string> > printedNames,
00037 Array< Array<std::string> > eventNames,
00038 Array<std::string> trackerTriggers,
00039 Array<std::string> btnDownTriggers,
00040 Array<std::string> btnUpTriggers,
00041 Array<std::string> disableTriggers,
00042 Array<std::string> enableTriggers,
00043 CoordinateFrame initialFrame);
00044
00045 virtual ~MultiColumnMenu();
00046
00047 int getNumRows() { return _items[0].size(); }
00048 int getNumColumns() { return _items.size(); }
00049
00050 void addRow(int insertBeforeRowNumber, Array<std::string> printedNames,
00051 Array<std::string> eventNames);
00052
00053 void enterDisabled(EventRef e);
00054 void exitDisabled(EventRef e);
00055
00056 void trackerMove(EventRef e);
00057 void trackerMoveInMenu(EventRef e);
00058 void trackerMoveBtnDown(EventRef e);
00059
00060 void menuBtnOn(EventRef e);
00061 void menuBtnOff(EventRef e);
00062
00063 void draw();
00064
00065 void setColumnJustify(int column, GFont::XAlign justify) {
00066 _columnJustify[column] = justify;
00067 }
00068
00069 void setTurnedOn(int column, int row, bool on) { _turnedOn[column][row]=on; }
00070 void setPrintedName(int column, int row, const std::string &newName) {
00071 _items[column][row] = newName;
00072 }
00073
00074 protected:
00075
00076 void generateBoxesGeometry();
00077
00078 void drawTextOnBox(const std::string &str, AABox box,
00079 Color4 color, Color4 outline, GFont::XAlign justify);
00080
00081 std::string _name;
00082 std::string _title;
00083 AABox _titleBox;
00084 ItemState _titleState;
00085 Array< Array<std::string> > _eventNames;
00086 Array< Array<std::string> > _items;
00087 Array< Array<AABox> > _boxes;
00088 Array< Array<ItemState> > _states;
00089 Array< Array<bool> > _turnedOn;
00090 Array<GFont::XAlign> _columnJustify;
00091 FsaRef _fsa;
00092 CoordinateFrame _dragOffset;
00093 bool _firstDrag;
00094 std::string _activeTracker;
00095 GFontRef _font;
00096 double _textHeight;
00097 double _padding;
00098 Color4 _outlineCol;
00099 Color4 _titleFG, _titleBG;
00100 Color4 _itemFG, _itemBG;
00101 Color4 _disabledFG, _disabledBG;
00102 Color4 _highltFG, _highltBG;
00103 Color4 _activatedFG, _activatedBG;
00104 };
00105
00106 }
00107
00108 #endif