BsEditorWindowManager.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsModule.h"
  4. #include "BsEvent.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Manages that handles creation, destruction and updates of editor windows.
  9. *
  10. * @note Internal class.
  11. */
  12. class BS_ED_EXPORT EditorWindowManager : public Module<EditorWindowManager>
  13. {
  14. public:
  15. EditorWindowManager();
  16. ~EditorWindowManager();
  17. /**
  18. * @brief Creates the main editor window using a previously created render window.
  19. * If a main window already exists, this will return the existing instance.
  20. */
  21. MainEditorWindow* createMain(const RenderWindowPtr& parentRenderWindow);
  22. /**
  23. * @brief Creates a new editor window. There is no limit on the number of editor windows.
  24. */
  25. EditorWindow* create();
  26. /**
  27. * @brief Notifies the manager that a new editor window was created.
  28. */
  29. void registerWindow(EditorWindowBase* window);
  30. /**
  31. * @brief Schedules the window for destruction. Actual destruction will happen on next update.
  32. */
  33. void destroy(EditorWindowBase* window);
  34. /**
  35. * @brief Returns the main editor window, or null if one doesn't exist.
  36. */
  37. MainEditorWindow* getMainWindow() const { return mMainWindow; }
  38. /**
  39. * @brief Update to be called once per frame. Calls update on all active editor windows.
  40. */
  41. void update();
  42. protected:
  43. MainEditorWindow* mMainWindow;
  44. Vector<EditorWindowBase*> mEditorWindows;
  45. Vector<EditorWindowBase*> mScheduledForDestruction;
  46. Vector<EditorWindowBase*> mEditorWindowsSnapshot;
  47. };
  48. }