GLWIconTable.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 _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         // Inhertied from GLWidget
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         // GLWButtonI
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 

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