BsEditorWidget.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include "BsEditorWidgetContainer.h"
  10. using namespace CamelotFramework;
  11. using namespace BansheeEngine;
  12. namespace BansheeEditor
  13. {
  14. EditorWidget::EditorWidget(const WString& name)
  15. :mName(name), mParent(nullptr), mContent(nullptr)
  16. {
  17. }
  18. EditorWidget::~EditorWidget()
  19. {
  20. }
  21. void EditorWidget::destroy(EditorWidget* widget)
  22. {
  23. cm_delete(widget);
  24. }
  25. void EditorWidget::_setPosition(INT32 x, INT32 y)
  26. {
  27. if(mContent == nullptr)
  28. return;
  29. mContent->setPosition(x, y);
  30. }
  31. void EditorWidget::_setSize(UINT32 width, UINT32 height)
  32. {
  33. if(mContent == nullptr)
  34. return;
  35. mContent->setSize(width, height);
  36. }
  37. void EditorWidget::_changeParent(EditorWidgetContainer* parent)
  38. {
  39. if(mParent != parent)
  40. {
  41. if(mParent == nullptr)
  42. mContent = GUIArea::create(parent->getParentWidget(), 0, 0, 0, 0, 10000);
  43. else
  44. mContent->changeParentWidget(parent->getParentWidget());
  45. mParent = parent;
  46. }
  47. }
  48. void EditorWidget::_disable()
  49. {
  50. mContent->disable();
  51. }
  52. void EditorWidget::_enable()
  53. {
  54. mContent->enable();
  55. }
  56. GUIWidget& EditorWidget::getParentWidget() const
  57. {
  58. return mParent->getParentWidget();
  59. }
  60. }