BsDockManagerLayout.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include "BsDockManagerLayout.h"
  2. #include "BsDockManagerLayoutRTTI.h"
  3. using namespace CamelotFramework;
  4. using namespace BansheeEngine;
  5. namespace BansheeEditor
  6. {
  7. DockManagerLayout::Entry::Entry()
  8. :isLeaf(true), firstChildSize(0), horizontalSplit(false),
  9. parent(nullptr)
  10. {
  11. children[0] = nullptr;
  12. children[1] = nullptr;
  13. }
  14. DockManagerLayout::Entry::~Entry()
  15. {
  16. if(!isLeaf)
  17. {
  18. if(children[0] != nullptr)
  19. cm_delete(children[0]);
  20. if(children[1] != nullptr)
  21. cm_delete(children[1]);
  22. }
  23. }
  24. DockManagerLayout::Entry* DockManagerLayout::Entry::createLeaf(Entry* parent, CM::UINT32 childIdx, const CM::Vector<CM::String>::type& widgetNames)
  25. {
  26. Entry* newEntry = cm_new<Entry>();
  27. newEntry->isLeaf = true;
  28. newEntry->parent = parent;
  29. if(parent != nullptr)
  30. parent->children[childIdx] = newEntry;
  31. newEntry->widgetNames = widgetNames;
  32. return newEntry;
  33. }
  34. DockManagerLayout::Entry* DockManagerLayout::Entry::createContainer(Entry* parent, CM::UINT32 childIdx, CM::UINT32 firstChildSize, bool horizontalSplit)
  35. {
  36. Entry* newEntry = cm_new<Entry>();
  37. newEntry->isLeaf = false;
  38. newEntry->parent = parent;
  39. if(parent != nullptr)
  40. parent->children[childIdx] = newEntry;
  41. newEntry->horizontalSplit = horizontalSplit;
  42. newEntry->firstChildSize = firstChildSize;
  43. return newEntry;
  44. }
  45. /************************************************************************/
  46. /* RTTI */
  47. /************************************************************************/
  48. RTTITypeBase* DockManagerLayout::getRTTIStatic()
  49. {
  50. return DockManagerLayoutRTTI::instance();
  51. }
  52. RTTITypeBase* DockManagerLayout::getRTTI() const
  53. {
  54. return DockManagerLayout::getRTTIStatic();
  55. }
  56. }