BsDockManager.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. namespace BansheeEditor
  4. {
  5. enum class DockLocation
  6. {
  7. Left, Right, Top, Bottom, Center
  8. };
  9. class DockManager
  10. {
  11. class DockContainer
  12. {
  13. public:
  14. DockContainer();
  15. ~DockContainer();
  16. void setArea(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
  17. void makeLeaf(BS::GUIWidget* widgetParent, EditorWidget* widget);
  18. void addLeft(BS::GUIWidget* widgetParent, EditorWidget* widget);
  19. void addRight(BS::GUIWidget* widgetParent, EditorWidget* widget);
  20. void addTop(BS::GUIWidget* widgetParent, EditorWidget* widget);
  21. void addBottom(BS::GUIWidget* widgetParent, EditorWidget* widget);
  22. DockContainer* find(EditorWidgetContainer* widgetContainer);
  23. bool mIsLeaf;
  24. DockContainer* mChildren[2];
  25. EditorWidgetContainer* mWidgets;
  26. CM::INT32 mX, mY;
  27. CM::UINT32 mWidth, mHeight;
  28. float mSplitPosition;
  29. bool mIsHorizontal;
  30. static const CM::UINT32 SliderSize;
  31. private:
  32. void splitContainer(BS::GUIWidget* widgetParent, EditorWidget* widget, bool horizontal, bool newChildIsFirst);
  33. };
  34. public:
  35. DockManager(BS::GUIWidget* parent);
  36. ~DockManager();
  37. void insert(EditorWidgetContainer* relativeTo, EditorWidget* widgetToInsert, DockLocation location);
  38. void setArea(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
  39. private:
  40. BS::GUIWidget* mParent;
  41. DockContainer mRootContainer;
  42. };
  43. }