BsEditorWindow.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 Triggered when the maximize button on the title bar is clicked.
  51. */
  52. void maximizeClicked();
  53. /**
  54. * @brief A callback that triggers when a drag and drop operation originated from
  55. * this window ends.
  56. *
  57. * @note This is a workaround to get around the problem that closing the window
  58. * when the drag operation starts (e.g. if the last widget is dragged from the window)
  59. * will cause the application to lose mouse capture and will not receive mouse events.
  60. * Therefore we delay the window closing until the drag ends.
  61. */
  62. void closeWindowDelayed();
  63. };
  64. }