DbgEditorWidget1.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 "BsEditorWidgetManager.h"
  10. using namespace CamelotFramework;
  11. using namespace BansheeEngine;
  12. namespace BansheeEditor
  13. {
  14. DbgEditorWidget1* DbgEditorWidget1::Instance = nullptr;
  15. DbgEditorWidget1::DbgEditorWidget1(const ConstructPrivately& dummy)
  16. :EditorWidget<DbgEditorWidget1>(HString(L"DbgEditorWidget1"))
  17. {
  18. }
  19. DbgEditorWidget1::~DbgEditorWidget1()
  20. {
  21. }
  22. void DbgEditorWidget1::initialize()
  23. {
  24. GUILayout& layout = mContent->getLayout();
  25. //
  26. //mDbgLabel = GUILabel::create(*mGUI, "Testing test");
  27. //layout.addElement(mDbgLabel);
  28. //layout.addElement(GUIInputBox::create(*mGUI));
  29. //layout.addElement(GUIInputBox::create(*mGUI, GUILayoutOptions::fixed(100, 100), true));
  30. GUIScrollArea* scrollArea = GUIScrollArea::create(getParentWidget());
  31. layout.addElement(scrollArea);
  32. GUILayout& scrollLayout = scrollArea->getLayout().addLayoutX();
  33. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test A"));
  34. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test B"));
  35. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test C"));
  36. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test D"));
  37. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test E"));
  38. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test F"));
  39. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test G"));
  40. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test H"));
  41. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test I"));
  42. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test J"));
  43. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test K"));
  44. //scrollLayout.addElement(GUIButton::create(*mGUI, L"Test L"));
  45. scrollLayout.addElement(GUIInputBox::create(getParentWidget(), true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
  46. scrollLayout.addElement(GUIInputBox::create(getParentWidget(), true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
  47. scrollLayout.addElement(GUIInputBox::create(getParentWidget(), true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
  48. //GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();
  49. //otherLayout.addElement(mDbgLabel);
  50. //GUIFixedSpace& space = otherLayout.addSpace(10); // Due to bug in MSVC compiler I need to store return value
  51. //GUIFlexibleSpace& space3 = otherLayout.addFlexibleSpace();
  52. //otherLayout.addElement(GUIWindowFrame::create(*mGUI, GUILayoutOptions::fixed(100, 100)));
  53. //GUIFixedSpace& space2 = otherLayout.addSpace(10);
  54. //otherLayout.addElement(GUIButton::create(*mGUI, "Test"));
  55. //otherLayout.addElement(GUIWindowFrame::create(*mGUI));
  56. //GUIArea* backgroundArea = GUIArea::create(*mGUI, 0, 0, 0, 0, 2000);
  57. //backgroundArea->getLayout().addElement(GUITexture::create(*mGUI, GUILayoutOptions::expandableXY(), GUIImageScaleMode::RepeatToFit, mGUI->getSkin()->getStyle("WindowBackground")));
  58. //GUIArea* windowFrameArea = GUIArea::create(*mGUI, 0, 0, 0, 0, 1999);
  59. //windowFrameArea->getLayout().addElement(GUIWindowFrame::create(*mGUI));
  60. //GUIArea* titleBarBackgroundArea = GUIArea::create(*mGUI, 0, 1, 0, 11, 1999);
  61. //titleBarBackgroundArea->getLayout().addSpace(1);
  62. //titleBarBackgroundArea->getLayout().addElement(GUITexture::create(*mGUI, GUIImageScaleMode::RepeatToFit, GUILayoutOptions::expandableXY(), mGUI->getGUISkin()->getStyle("TitleBarBg")));
  63. //titleBarBackgroundArea->getLayout().addSpace(1);
  64. //mRenderWindow->resize(300, 250);
  65. //mRenderWindow->setVisible(false);
  66. }
  67. DbgEditorWidget1* DbgEditorWidget1::instance()
  68. {
  69. return Instance;
  70. }
  71. DbgEditorWidget1* DbgEditorWidget1::open()
  72. {
  73. return static_cast<DbgEditorWidget1*>(EditorWidgetManager::instance().open(getTypeName()));
  74. }
  75. void DbgEditorWidget1::close()
  76. {
  77. if(Instance != nullptr)
  78. EditorWidgetManager::instance().close(Instance);
  79. Instance = nullptr;
  80. }
  81. const String& DbgEditorWidget1::getTypeName()
  82. {
  83. static String name = "DbgEditorWidget1";
  84. return name;
  85. }
  86. }