BsEditorWidget.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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), mContent(nullptr)
  15. {
  16. }
  17. EditorWidget::~EditorWidget()
  18. {
  19. }
  20. void EditorWidget::destroy(EditorWidget* widget)
  21. {
  22. cm_delete(widget);
  23. }
  24. void EditorWidget::_setPosition(INT32 x, INT32 y)
  25. {
  26. if(mContent == nullptr)
  27. return;
  28. mContent->setPosition(x, y);
  29. }
  30. void EditorWidget::_setSize(UINT32 width, UINT32 height)
  31. {
  32. if(mContent == nullptr)
  33. return;
  34. mContent->setSize(width, height);
  35. }
  36. void EditorWidget::_changeParent(BS::GUIWidget& widget)
  37. {
  38. if(mParentWidget != &widget)
  39. {
  40. if(mParentWidget == nullptr)
  41. mContent = GUIArea::create(widget, 0, 0, 0, 0, 10000);
  42. else
  43. mContent->changeParentWidget(widget);
  44. mParentWidget = &widget;
  45. }
  46. }
  47. void EditorWidget::_disable()
  48. {
  49. mContent->disable();
  50. }
  51. void EditorWidget::_enable()
  52. {
  53. mContent->enable();
  54. }
  55. }