BsEditorWidget.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "BsEditorWidget.h"
  2. #include "BsGUIManager.h"
  3. #include "BsGUIWidget.h"
  4. #include "BsGUITexture.h"
  5. #include "BsGUISkin.h"
  6. #include "BsGUILayout.h"
  7. #include "BsEngineGUI.h"
  8. #include "BsGUIArea.h"
  9. using namespace CamelotFramework;
  10. using namespace BansheeEngine;
  11. namespace BansheeEditor
  12. {
  13. EditorWidget::EditorWidget(const WString& name)
  14. :mName(name), mParentWidget(nullptr)
  15. {
  16. }
  17. EditorWidget::~EditorWidget()
  18. {
  19. }
  20. void EditorWidget::_initialize(GUIWidget& widget, INT32 x, INT32 y, UINT32 width, UINT32 height)
  21. {
  22. _changeParent(widget);
  23. _setArea(x, y, width, height);
  24. }
  25. void EditorWidget::_setArea(INT32 x, INT32 y, UINT32 width, UINT32 height)
  26. {
  27. if(mContent != nullptr)
  28. return;
  29. mContent->setPosition(x, y);
  30. mContent->setSize(width, height);
  31. }
  32. void EditorWidget::_changeParent(BS::GUIWidget& widget)
  33. {
  34. if(mParentWidget != &widget)
  35. {
  36. // TODO - GUIArea mContent should be recreated (or moved) to the new widget
  37. }
  38. mParentWidget = &widget;
  39. mContent = GUIArea::create(widget, 0, 0, 0, 0, 10000);
  40. }
  41. }