Handle OptionEntryEnum in the console
[scorched3d/parasti.git] / src / client / GLW / GLWPanel.h
blobb4d8ec0baed39ece08e34406cca05d9f496c4621
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 #if !defined(AFX_GLWPANEL_H__6619410E_0A6B_459B_8A38_11024F49A6E3__INCLUDED_)
22 #define AFX_GLWPANEL_H__6619410E_0A6B_459B_8A38_11024F49A6E3__INCLUDED_
24 #include <list>
25 #include <GLW/GLWidget.h>
27 /**
28 A container widget for other widgets.
29 Also controls how widgets are layed out.
30 **/
31 class GLWPanel : public GLWidget
33 public:
34 enum LayoutFlags
36 SpaceRight = 1,
37 SpaceLeft = 2,
38 SpaceTop = 4,
39 SpaceBottom = 8,
40 SpaceAll = 16,
41 AlignLeft = 32,
42 AlignRight = 64,
43 AlignCenterLeftRight = 128,
44 AlignTop = 256,
45 AlignBottom = 512,
46 AlignCenterTopBottom = 1024
48 enum LayoutType
50 LayoutNone,
51 LayoutHorizontal,
52 LayoutVerticle,
53 LayoutGrid
56 struct GLWPanelEntry
58 GLWPanelEntry(GLWidget *widget, GLWCondition *con,
59 unsigned int flags, float width);
61 GLWidget *widget;
62 GLWCondition *condition;
63 float leftSpace;
64 float rightSpace;
65 float topSpace;
66 float bottomSpace;
67 unsigned flags;
70 GLWPanel(float x = 0.0f, float y = 0.0f,
71 float w = 0.0f, float h = 0.0f,
72 bool depressed = false,
73 bool visible = true,
74 bool ridge = false);
75 virtual ~GLWPanel();
77 virtual void simulate(float frameTime);
78 virtual void draw();
79 virtual void mouseDown(int button, float x, float y, bool &skipRest);
80 virtual void mouseUp(int button, float x, float y, bool &skipRest);
81 virtual void mouseDrag(int button, float mx, float my, float x, float y, bool &skipRest);
82 virtual void keyDown(char *buffer, unsigned int keyState,
83 KeyboardHistory::HistoryElement *history, int hisCount,
84 bool &skipRest);
85 virtual void mouseWheel(float x, float y, float z, bool &skipRest);
86 virtual void display();
87 virtual void hide();
89 virtual bool initFromXML(XMLNode *node);
90 virtual void clear();
91 virtual void layout();
93 virtual void setLayout(unsigned int layout);
94 virtual unsigned int getLayout();
95 virtual void setGridWidth(unsigned int grid);
96 virtual unsigned int getGridWidth();
98 GLWidget *addWidget(GLWidget *widget, GLWCondition *condition = 0,
99 unsigned int flags = 0,
100 float width = 0.0f);
101 std::list<GLWPanelEntry> &getWidgets() { return widgets_; }
102 GLWidget *getWidgetByName(const char *name);
104 REGISTER_CLASS_HEADER(GLWPanel);
106 // Accessors
107 bool &getDrawPanel() { return drawPanel_; }
109 protected:
110 std::list<GLWPanelEntry> widgets_;
111 bool depressed_;
112 bool drawPanel_;
113 bool ridge_;
114 unsigned int layout_;
115 unsigned int gridWidth_;
119 #endif // !defined(AFX_GLWPANEL_H__6619410E_0A6B_459B_8A38_11024F49A6E3__INCLUDED_)