BsEditorWindowManager.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "Utility/BsModule.h"
  6. #include "Utility/BsEvent.h"
  7. namespace bs
  8. {
  9. /** @addtogroup EditorWindow-Internal
  10. * @{
  11. */
  12. /** Manages that handles creation, destruction and updates of editor windows. */
  13. class BS_ED_EXPORT EditorWindowManager : public Module<EditorWindowManager>
  14. {
  15. public:
  16. EditorWindowManager();
  17. ~EditorWindowManager();
  18. /**
  19. * Creates the main editor window using a previously created render window. If a main window already exists, this
  20. * will return the existing instance.
  21. */
  22. MainEditorWindow* createMain(const SPtr<RenderWindow>& parentRenderWindow);
  23. /** Creates a new editor window. There is no limit on the number of editor windows. */
  24. EditorWindow* create();
  25. /** Notifies the manager that a new editor window was created. */
  26. void registerWindow(EditorWindowBase* window);
  27. /** Schedules the window for destruction. Actual destruction will happen on next update. */
  28. void destroy(EditorWindowBase* window);
  29. /** Returns the main editor window, or null if one doesn't exist. */
  30. MainEditorWindow* getMainWindow() const { return mMainWindow; }
  31. /** Update to be called once per frame. Calls update on all active editor windows. */
  32. void update();
  33. /** Checks if any editor window has keyboard focus. */
  34. bool hasFocus() const;
  35. /**
  36. * By default all windows are created as hidden. After this method is called all windows will be shown, and
  37. * any new windows will be shown by default.
  38. */
  39. void showWindows();
  40. /** Checks if new editor windows should be created hidden. */
  41. bool areNewWindowsHidden() const { return mNewWindowsHidden; }
  42. protected:
  43. bool mNewWindowsHidden = true;
  44. MainEditorWindow* mMainWindow;
  45. Vector<EditorWindowBase*> mEditorWindows;
  46. Vector<EditorWindowBase*> mScheduledForDestruction;
  47. Vector<EditorWindowBase*> mEditorWindowsSnapshot;
  48. };
  49. /** @} */
  50. }