BsEditorWindowManager.h 1.8 KB

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