BsEditorWindowManager.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /**
  43. * @brief Checks if any editor window has keyboard focus.
  44. */
  45. bool hasFocus() const;
  46. protected:
  47. MainEditorWindow* mMainWindow;
  48. Vector<EditorWindowBase*> mEditorWindows;
  49. Vector<EditorWindowBase*> mScheduledForDestruction;
  50. Vector<EditorWindowBase*> mEditorWindowsSnapshot;
  51. };
  52. }