lugre_widget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LUGRE_WIDGET_H
00025 #define LUGRE_WIDGET_H
00026
00027 #include <OgrePrerequisites.h>
00028 #include <map>
00029 #include <list>
00030 #include "lugre_ColourClipPaneOverlay.h"
00031 #include "lugre_smartptr.h"
00032 #include "lugre_bitmask.h"
00033
00034 using Ogre::Real;
00035
00036 class lua_State;
00037
00038 namespace Lugre {
00039
00040 class cGfx2D;
00041 class cDialog;
00042 class cWidget;
00043
00045 class cDialogManager { public:
00046
00047 cDialogManager();
00048 inline static cDialogManager& GetSingleton () {
00049 static cDialogManager* mSingleton = 0;
00050 if (!mSingleton) mSingleton = new cDialogManager();
00051 return *mSingleton;
00052 }
00053
00054
00055 cDialog* MyCreateDialog ();
00056 void DestroyDialog (cDialog* pDialog);
00057 void BringToFront (cDialog* pDialog);
00058 void SendToBack (cDialog* pDialog);
00059 void Reorder ();
00060
00062 cDialog* GetDialogUnderPos (const size_t x,const size_t y);
00063 cWidget* GetWidgetUnderPos (const size_t x,const size_t y);
00064
00065 public:
00066 std::list<cDialog*> mlDialogs;
00067 };
00068
00069
00071 class cDialog : public cSmartPointable { public:
00072 size_t miUID;
00073 std::list<cWidget*> mlRootWidget;
00074 bool mbVisible;
00075 Ogre::Overlay* mpOverlay;
00076
00077 cDialog ();
00078 cDialog (const size_t iInitialZOrder);
00079 ~cDialog ();
00080
00081 cWidget* CreateWidget (cWidget* pParent=0);
00082 void DestroyWidget (cWidget* pWidget);
00083
00084 void BringToFront ();
00085 void SendToBack ();
00086 void SetVisible (const bool bVisible);
00087 bool GetVisible ();
00088 void SetZOrder (const size_t iZOrder);
00089
00090 bool IsUnderPos (const size_t x,const size_t y);
00091 cWidget* GetWidgetUnderPos (const size_t x,const size_t y);
00092
00094 static void LuaRegister (lua_State *L);
00095 };
00096
00097
00098 class cWidget : public cSmartPointable { public:
00099 size_t miUID;
00100 cDialog* mpDialog;
00101 cWidget* mpParent;
00102 cGfx2D* mpGfx2D;
00103 bool mbIgnoreMouseOver;
00104 bool mbClipChildsHitTest;
00105 cBitMask* mpBitMask;
00106 std::list<cWidget*> mlChild;
00107
00108 cWidget();
00109 cWidget(cDialog* pDialog,cWidget* pParent=0);
00110 ~cWidget();
00111
00112 void Destroy ();
00113 cWidget* CreateChild ();
00114 void AttachChild (cWidget* pWidget);
00115 void DetachChild (cWidget* pWidget);
00116
00118 void UpdateClip (const Ogre::Real fMarginL=0,const Ogre::Real fMarginT=0,const Ogre::Real fMarginR=0,const Ogre::Real fMarginB=0);
00119
00120 bool IsUnderPos (const size_t x,const size_t y);
00121 cWidget* GetChildUnderPos (const size_t x,const size_t y);
00122
00124 static void LuaRegister (lua_State *L);
00125 };
00126
00127 };
00128
00129 #endif