Mercurial > LightClone
view LightClone/Source/GuiElement.h @ 54:95677f648a2c VirtualMachine Mk2
Refactored VirtualMachine
author | koryspansel |
---|---|
date | Fri, 30 Sep 2011 18:37:54 -0700 |
parents | efd2b1ca5b77 |
children | 3507bd831c7f |
line wrap: on
line source
/* * GuiElement */ #ifndef __GUIELEMENT_H__ #define __GUIELEMENT_H__ #include "Core.h" #include "ResourceManager.h" #include "RenderContext.h" #include "Camera.h" #include "ArrayList.h" #include "GuiEventMap.h" #include "GuiRenderContext.h" /* * GuiElementFlag */ enum { GuiElementFlag_Visible = 1 << 0, GuiElementFlag_Pickable = 1 << 1, }; /* * GuiElement */ class GuiElement : private GuiEventMap { /* * GuiInterface */ friend class GuiInterface; public: /* * EventDrop */ static const char* EventDrop; /* * List */ typedef ArrayList<GuiElement*> List; protected: /* * pResourceManager */ ResourceManager* pResourceManager; /* * pInterface */ GuiInterface* pInterface; /* * pContainer */ GuiElement* pContainer; /* * kPosition */ D3DXVECTOR2 kPosition; /* * fDepth */ float fDepth; /* * kDimensions */ D3DXVECTOR2 kDimensions; /* * kColor */ D3DCOLOR kColor; /* * nFlags */ uint32 nFlags; /* * kChildren */ List kChildren; public: /* * GuiElement */ GuiElement(); /* * ~GuiElement */ virtual ~GuiElement(); /* * Initialize */ virtual ErrorCode Initialize(ResourceManager* pResourceManager); /* * Terminate */ virtual void Terminate(); /* * Update */ virtual void Update(float fElapsed); /* * Render */ virtual void Render(GuiRenderContext& kContext); /* * SetInterface */ void SetInterface(GuiInterface* pInstance); /* * GetInterface */ GuiInterface* GetInterface(); /* * SetParent */ void SetParent(GuiElement* pInstance); /* * GetParent */ GuiElement* GetParent(); /* * SetPosition */ void SetPosition(float fX, float fY); /* * SetPosition */ void SetPosition(const D3DXVECTOR2& kValue); /* * GetPosition */ const D3DXVECTOR2 GetPosition() const; /* * SetDepth */ void SetDepth(float fDepth); /* * GetDepth */ float GetDepth() const; /* * SetDimensions */ void SetDimensions(float fWidth, float fHeight); /* * SetDimensions */ void SetDimensions(const D3DXVECTOR2& kValue); /* * GetDimensions */ const D3DXVECTOR2 GetDimensions() const; /* * GetWidth */ float GetWidth() const; /* * GetHeight */ float GetHeight() const; /* * SetFlag */ void SetFlag(uint32 nValue); /* * ClearFlag */ void ClearFlag(uint32 nValue); /* * HasFlag */ bool HasFlag(uint32 nValue) const; /* * IsVisible */ bool IsVisible() const; /* * SetColor */ void SetColor(D3DCOLOR nColor); /* * Pick */ virtual GuiElement* Pick(float fX, float fY); /* * Add */ ErrorCode Add(GuiElement* pElement); /* * Remove */ ErrorCode Remove(GuiElement* pElement); /* * Contains */ bool Contains(float fX, float fY); /* * Subscribe */ using GuiEventMap::Subscribe; /* * Fire */ using GuiEventMap::Fire; protected: /* * OnMouseEnter */ virtual void OnMouseEnter(); /* * OnMouseLeave */ virtual void OnMouseLeave(); /* * OnMouseDown */ virtual void OnMouseDown(uint32 nButton, float fX, float fY); /* * OnMouseUp */ virtual void OnMouseUp(uint32 nButton, float fX, float fY); /* * OnMouseMove */ virtual void OnMouseMove(float fX, float fY); /* * OnDrop */ virtual void OnDrop(GuiElement* pSource, float fX, float fY); }; #endif //__GUIELEMENT_H__