BsGUIElement.cpp 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "BsGUIElement.h"
  2. #include "BsGUIWidget.h"
  3. #include "BsGUISkin.h"
  4. #include "BsGUILayout.h"
  5. #include "CmException.h"
  6. using namespace CamelotFramework;
  7. namespace BansheeEngine
  8. {
  9. GUIElement::GUIElement(GUIWidget& parent, const GUI_LAYOUT_OPTIONS& layoutOptions)
  10. :mParent(parent), mIsDirty(true), mParentLayout(nullptr), mLayoutOptions(layoutOptions), mWidth(0), mHeight(0), mDepth(0)
  11. {
  12. mParent.registerElement(this);
  13. }
  14. GUIElement::~GUIElement()
  15. {
  16. if(mParentLayout != nullptr)
  17. mParentLayout->removeElement(this);
  18. }
  19. void GUIElement::updateRenderElements()
  20. {
  21. updateRenderElementsInternal();
  22. markAsClean();
  23. }
  24. bool GUIElement::mouseEvent(const GUIMouseEvent& ev)
  25. {
  26. return false;
  27. }
  28. void GUIElement::destroyInternal(GUIElement* element)
  29. {
  30. CM_DELETE(element, GUIElement, PoolAlloc);
  31. }
  32. void GUIElement::destroy(GUIElement* element)
  33. {
  34. element->mParent.unregisterElement(element);
  35. CM_DELETE(element, GUIElement, PoolAlloc);
  36. }
  37. }