BsEditorWindow.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsEditorWindowBase.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief A draggable and resizeable window that has a single widget container
  8. * you may use for docking editor widgets in.
  9. */
  10. class BS_ED_EXPORT EditorWindow : public EditorWindowBase
  11. {
  12. public:
  13. virtual ~EditorWindow();
  14. /**
  15. * @brief Returns the widget container for this window.
  16. */
  17. EditorWidgetContainer& widgets() const { return *mWidgets; }
  18. /**
  19. * @copydoc EditorWindowBase::update
  20. */
  21. virtual void update() override;
  22. /**
  23. * @brief Creates a new empty editor window.
  24. */
  25. static EditorWindow* create();
  26. protected:
  27. friend class EditorWindowManager;
  28. EditorWindow();
  29. /**
  30. * @copydoc EditorWindowBase::resized
  31. */
  32. virtual void resized() override;
  33. private:
  34. EditorWidgetContainer* mWidgets;
  35. /**
  36. * @brief Updates the sizes of the child widget container and
  37. * OS non-client areas (like drag and resize). Call when window
  38. * size changes.
  39. */
  40. void updateSize();
  41. /**
  42. * @brief Called when a widget is added to the widget container.
  43. */
  44. void widgetAdded();
  45. /**
  46. * @brief Called when a widget is removed from the widget container.
  47. */
  48. void widgetRemoved();
  49. /**
  50. * @brief A callback that triggers when a drag and drop operation originated from
  51. * this window ends.
  52. *
  53. * @note This is a workaround to get around the problem that closing the window
  54. * when the drag operation starts (e.g. if the last widget is dragged from the window)
  55. * will cause the application to lose mouse capture and will not receive mouse events.
  56. * Therefore we delay the window closing until the drag ends.
  57. */
  58. void closeWindowDelayed();
  59. };
  60. }