BsEditorWindow.h 2.1 KB

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