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