git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / client / GLW / GLWIconTable.h
blobf7da27bcc2c67409083475ed0edc010b006737c1
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
3 //
4 // This file is part of Scorched3D.
5 //
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #ifndef _GLWIconTable_h
22 #define _GLWIconTable_h
24 #include <GLW/GLWScrollWBackwards.h>
25 #include <GLW/GLWTextButton.h>
26 #include <GLW/GLWToolTip.h>
27 #include <vector>
28 #include <list>
30 class GLWIconTableI
32 public:
33 virtual void drawColumn(unsigned int id, int row, int column, float x, float y, float w) = 0;
34 virtual void rowSelected(unsigned int id, int row) = 0;
35 virtual void columnSelected(unsigned int id, int col) = 0;
36 virtual void rowChosen(unsigned int id, int row) = 0;
39 class GLWIconTable :
40 public GLWidget,
41 public GLWButtonI
43 public:
44 struct Column
46 Column(const LangString &name_ = LangString(), float width_ = 0.0f) :
47 name(name_), width(width_)
51 LangString name;
52 float width;
55 GLWIconTable(float x = 0.0f, float y = 0.0f,
56 float w = 0.0f, float h = 0.0f,
57 std::list<Column> *columns = 0,
58 float rowHeight = 20.0f);
59 virtual ~GLWIconTable();
61 void setItemCount(int items);
62 int getItemCount() { return itemCount_; }
64 void setHandler(GLWIconTableI *handler) { handler_ = handler; }
65 int getSelected() { return selected_; }
67 // Inhertied from GLWidget
68 virtual void draw();
69 virtual void simulate(float frameTime);
70 virtual void mouseDown(int button, float x, float y, bool &skipRest);
71 virtual void mouseUp(int button, float x, float y, bool &skipRest);
72 virtual void mouseDrag(int button, float mx, float my, float x, float y,
73 bool &skipRest);
74 virtual void mouseWheel(float x, float y, float z, bool &skipRest);
76 // GLWButtonI
77 virtual void buttonDown(unsigned int id);
79 REGISTER_CLASS_HEADER(GLWIconTable);
80 protected:
81 std::vector<GLWTextButton *> columns_;
82 GLWScrollWBackwards scrollBar_;
83 GLWIconTableI *handler_;
84 float rowHeight_;
85 int selected_;
86 int itemCount_;
88 private:
89 GLWIconTable(const GLWIconTable &);
90 const GLWIconTable & operator=(const GLWIconTable &);
93 #endif // _GLWIconTable_h