GLWPanel.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 #if !defined(AFX_GLWPANEL_H__6619410E_0A6B_459B_8A38_11024F49A6E3__INCLUDED_)
00022 #define AFX_GLWPANEL_H__6619410E_0A6B_459B_8A38_11024F49A6E3__INCLUDED_
00023 
00024 #include <list>
00025 #include <GLW/GLWidget.h>
00026 
00027 /**
00028 A container widget for other widgets.
00029 Also controls how widgets are layed out.
00030 **/
00031 class GLWPanel : public GLWidget
00032 {
00033 public:
00034         enum LayoutFlags
00035         {
00036                 SpaceRight = 1,
00037                 SpaceLeft = 2,
00038                 SpaceTop = 4,
00039                 SpaceBottom = 8,
00040                 SpaceAll = 16,
00041                 AlignLeft = 32,
00042                 AlignRight = 64,
00043                 AlignCenterLeftRight = 128,
00044                 AlignTop = 256,
00045                 AlignBottom = 512,
00046                 AlignCenterTopBottom = 1024
00047         };
00048         enum LayoutType
00049         {
00050                 LayoutNone,
00051                 LayoutHorizontal,
00052                 LayoutVerticle,
00053                 LayoutGrid
00054         };
00055 
00056         struct GLWPanelEntry
00057         {
00058                 GLWPanelEntry(GLWidget *widget, GLWCondition *con,
00059                         unsigned int flags, float width); 
00060 
00061                 GLWidget *widget;
00062                 GLWCondition *condition;
00063                 float leftSpace;
00064                 float rightSpace;
00065                 float topSpace;
00066                 float bottomSpace;
00067                 unsigned flags;
00068         };
00069 
00070         GLWPanel(float x = 0.0f, float y = 0.0f, 
00071                 float w = 0.0f, float h = 0.0f, 
00072                 bool depressed = false,
00073                 bool visible = true,
00074                 bool ridge = false);
00075         virtual ~GLWPanel();
00076 
00077         virtual void simulate(float frameTime);
00078         virtual void draw();
00079         virtual void mouseDown(int button, float x, float y, bool &skipRest);
00080         virtual void mouseUp(int button, float x, float y, bool &skipRest);
00081         virtual void mouseDrag(int button, float mx, float my, float x, float y, bool &skipRest);
00082         virtual void keyDown(char *buffer, unsigned int keyState, 
00083                 KeyboardHistory::HistoryElement *history, int hisCount, 
00084                 bool &skipRest);
00085         virtual void mouseWheel(float x, float y, float z, bool &skipRest);
00086         virtual void display();
00087         virtual void hide();
00088 
00089         virtual bool initFromXML(XMLNode *node);
00090         virtual void clear();
00091         virtual void layout();
00092 
00093         virtual void setLayout(unsigned int layout);
00094         virtual unsigned int getLayout();
00095         virtual void setGridWidth(unsigned int grid);
00096         virtual unsigned int getGridWidth();
00097 
00098         GLWidget *addWidget(GLWidget *widget, GLWCondition *condition = 0, 
00099                 unsigned int flags = 0, 
00100                 float width = 0.0f);
00101         std::list<GLWPanelEntry> &getWidgets() { return widgets_; }
00102         GLWidget *getWidgetByName(const char *name);
00103 
00104         REGISTER_CLASS_HEADER(GLWPanel);
00105 
00106         // Accessors
00107         bool &getDrawPanel() { return drawPanel_; }
00108 
00109 protected:
00110         std::list<GLWPanelEntry> widgets_;
00111         bool depressed_;
00112         bool drawPanel_;
00113         bool ridge_;
00114         unsigned int layout_;
00115         unsigned int gridWidth_;
00116 
00117 };
00118 
00119 #endif // !defined(AFX_GLWPANEL_H__6619410E_0A6B_459B_8A38_11024F49A6E3__INCLUDED_)

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