GLWIconList.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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         // Inhertied from GLWidget
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 

Generated on Mon Feb 16 15:14:45 2009 for Scorched3D by  doxygen 1.5.3