00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00029
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
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_)