00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _GLWIconTable_h
00022 #define _GLWIconTable_h
00023
00024 #include <GLW/GLWScrollWBackwards.h>
00025 #include <GLW/GLWTextButton.h>
00026 #include <GLW/GLWToolTip.h>
00027 #include <vector>
00028 #include <list>
00029
00030 class GLWIconTableI
00031 {
00032 public:
00033 virtual void drawColumn(unsigned int id, int row, int column, float x, float y, float w) = 0;
00034 virtual void rowSelected(unsigned int id, int row) = 0;
00035 virtual void columnSelected(unsigned int id, int col) = 0;
00036 virtual void rowChosen(unsigned int id, int row) = 0;
00037 };
00038
00039 class GLWIconTable :
00040 public GLWidget,
00041 public GLWButtonI
00042 {
00043 public:
00044 struct Column
00045 {
00046 Column(const LangString &name_ = LangString(), float width_ = 0.0f) :
00047 name(name_), width(width_)
00048 {
00049 }
00050
00051 LangString name;
00052 float width;
00053 };
00054
00055 GLWIconTable(float x = 0.0f, float y = 0.0f,
00056 float w = 0.0f, float h = 0.0f,
00057 std::list<Column> *columns = 0,
00058 float rowHeight = 20.0f);
00059 virtual ~GLWIconTable();
00060
00061 void setItemCount(int items);
00062 int getItemCount() { return itemCount_; }
00063
00064 void setHandler(GLWIconTableI *handler) { handler_ = handler; }
00065 int getSelected() { return selected_; }
00066
00067
00068 virtual void draw();
00069 virtual void simulate(float frameTime);
00070 virtual void mouseDown(int button, float x, float y, bool &skipRest);
00071 virtual void mouseUp(int button, float x, float y, bool &skipRest);
00072 virtual void mouseDrag(int button, float mx, float my, float x, float y,
00073 bool &skipRest);
00074 virtual void mouseWheel(float x, float y, float z, bool &skipRest);
00075
00076
00077 virtual void buttonDown(unsigned int id);
00078
00079 REGISTER_CLASS_HEADER(GLWIconTable);
00080 protected:
00081 std::vector<GLWTextButton *> columns_;
00082 GLWScrollWBackwards scrollBar_;
00083 GLWIconTableI *handler_;
00084 float rowHeight_;
00085 int selected_;
00086 int itemCount_;
00087
00088 private:
00089 GLWIconTable(const GLWIconTable &);
00090 const GLWIconTable & operator=(const GLWIconTable &);
00091 };
00092
00093 #endif // _GLWIconTable_h
00094