DbgEditorWidget1.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #include "DbgEditorWidget1.h"
  2. #include "BsEditorWindow.h"
  3. #include "BsGUILabel.h"
  4. #include "BsGUIButton.h"
  5. #include "BsGUIInputBox.h"
  6. #include "BsGUIScrollArea.h"
  7. #include "BsGUIArea.h"
  8. #include "BsGUILayout.h"
  9. #include "BsEditorWindow.h"
  10. #include "BsEditorWidgetContainer.h"
  11. using namespace CamelotFramework;
  12. using namespace BansheeEngine;
  13. namespace BansheeEditor
  14. {
  15. DbgEditorWidget1* DbgEditorWidget1::Instance = nullptr;
  16. DbgEditorWidget1::DbgEditorWidget1()
  17. :EditorWidget(HString(L"DbgEditorWidget1"))
  18. {
  19. }
  20. DbgEditorWidget1::~DbgEditorWidget1()
  21. {
  22. }
  23. void DbgEditorWidget1::initialize()
  24. {
  25. GUILayout& layout = mContent->getLayout();
  26. //
  27. //mDbgLabel = GUILabel::create(*mGUI, "Testing test");
  28. //layout.addElement(mDbgLabel);
  29. //layout.addElement(GUIInputBox::create(*mGUI));
  30. //layout.addElement(GUIInputBox::create(*mGUI, GUILayoutOptions::fixed(100, 100), true));
  31. GUIScrollArea* scrollArea = GUIScrollArea::create(getParentWidget());
  32. layout.addElement(scrollArea);
  33. GUILayout& scrollLayout = scrollArea->getLayout().addLayoutX();
  34. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test A"));
  35. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test B"));
  36. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test C"));
  37. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test D"));
  38. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test E"));
  39. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test F"));
  40. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test G"));
  41. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test H"));
  42. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test I"));
  43. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test J"));
  44. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test K"));
  45. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test L"));
  46. scrollLayout.addElement(GUIInputBox::create(getParentWidget(), GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100)), true));
  47. scrollLayout.addElement(GUIInputBox::create(getParentWidget(), GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100)), true));
  48. scrollLayout.addElement(GUIInputBox::create(getParentWidget(), GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100)), true));
  49. //GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();
  50. //otherLayout.addElement(mDbgLabel);
  51. //GUIFixedSpace& space = otherLayout.addSpace(10); // Due to bug in MSVC compiler I need to store return value
  52. //GUIFlexibleSpace& space3 = otherLayout.addFlexibleSpace();
  53. //otherLayout.addElement(GUIWindowFrame::create(*mGUI, GUILayoutOptions::fixed(100, 100)));
  54. //GUIFixedSpace& space2 = otherLayout.addSpace(10);
  55. //otherLayout.addElement(GUIButton::create(*mGUI, "Test"));
  56. //otherLayout.addElement(GUIWindowFrame::create(*mGUI));
  57. //GUIArea* backgroundArea = GUIArea::create(*mGUI, 0, 0, 0, 0, 2000);
  58. //backgroundArea->getLayout().addElement(GUITexture::create(*mGUI, GUILayoutOptions::expandableXY(), GUIImageScaleMode::RepeatToFit, mGUI->getSkin()->getStyle("WindowBackground")));
  59. //GUIArea* windowFrameArea = GUIArea::create(*mGUI, 0, 0, 0, 0, 1999);
  60. //windowFrameArea->getLayout().addElement(GUIWindowFrame::create(*mGUI));
  61. //GUIArea* titleBarBackgroundArea = GUIArea::create(*mGUI, 0, 1, 0, 11, 1999);
  62. //titleBarBackgroundArea->getLayout().addSpace(1);
  63. //titleBarBackgroundArea->getLayout().addElement(GUITexture::create(*mGUI, GUIImageScaleMode::RepeatToFit, GUILayoutOptions::expandableXY(), mGUI->getGUISkin()->getStyle("TitleBarBg")));
  64. //titleBarBackgroundArea->getLayout().addSpace(1);
  65. //mRenderWindow->resize(300, 250);
  66. //mRenderWindow->setVisible(false);
  67. }
  68. DbgEditorWidget1* DbgEditorWidget1::instance()
  69. {
  70. return Instance;
  71. }
  72. DbgEditorWidget1* DbgEditorWidget1::open()
  73. {
  74. if(Instance != nullptr)
  75. return Instance;
  76. EditorWindow* newWindow = EditorWindow::create();
  77. DbgEditorWidget1* newWidget = new (cm_alloc<DbgEditorWidget1>()) DbgEditorWidget1();
  78. newWindow->widgets().add(*newWidget);
  79. newWidget->initialize();
  80. Instance = newWidget;
  81. return newWidget;
  82. }
  83. void DbgEditorWidget1::close()
  84. {
  85. if(Instance != nullptr)
  86. {
  87. Instance->mParent->_notifyWidgetDestroyed(Instance);
  88. EditorWidget::destroy(Instance);
  89. }
  90. Instance = nullptr;
  91. }
  92. }