00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _GLWIconList_h
00022 #define _GLWIconList_h
00023
00024 #include <GLW/GLWScrollWBackwards.h>
00025 #include <GLW/GLWToolTip.h>
00026 #include <vector>
00027
00028 class GLWIconListI
00029 {
00030 public:
00031 virtual void selected(unsigned int id, int position) = 0;
00032 virtual void chosen(unsigned int id, int position) = 0;
00033 };
00034
00035 class GLWIconListItem
00036 {
00037 public:
00038 virtual void draw(float x, float y, float w) = 0;
00039 };
00040
00041 class GLWIconList : public GLWidget
00042 {
00043 public:
00044 enum Flags
00045 {
00046 eNoDrawSelected = 1
00047 };
00048
00049 GLWIconList(float x = 0.0f, float y = 0.0f,
00050 float w = 0.0f, float h = 0.0f,
00051 float squaresHeight = 40.0f,
00052 unsigned int flags = 0);
00053 virtual ~GLWIconList();
00054
00055 void addItem(GLWIconListItem *item);
00056 void clear();
00057
00058 void setFlags(unsigned int flags) { flags_ = flags; }
00059 void setHandler(GLWIconListI *handler) { handler_ = handler; }
00060
00061 GLWIconListItem *getSelected();
00062 std::vector<GLWIconListItem *> &getItems() { return items_; }
00063
00064
00065 virtual void draw();
00066 virtual void simulate(float frameTime);
00067 virtual void mouseDown(int button, float x, float y, bool &skipRest);
00068 virtual void mouseUp(int button, float x, float y, bool &skipRest);
00069 virtual void mouseDrag(int button, float mx, float my, float x, float y,
00070 bool &skipRest);
00071 virtual void mouseWheel(float x, float y, float z, bool &skipRest);
00072
00073 REGISTER_CLASS_HEADER(GLWIconList);
00074 protected:
00075 GLWScrollWBackwards scrollBar_;
00076 GLWIconListI *handler_;
00077 unsigned int flags_;
00078 float squaresHeight_;
00079 int selected_;
00080 std::vector<GLWIconListItem *> items_;
00081
00082 private:
00083 GLWIconList(const GLWIconList &);
00084 const GLWIconList & operator=(const GLWIconList &);
00085 };
00086
00087 #endif // _GLWIconList_h
00088