BsGUIWindowFrameWidget.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "GUI/BsCGUIWidget.h"
  6. #include "Utility/BsEvent.h"
  7. namespace bs
  8. {
  9. /** @addtogroup GUI-Editor-Internal
  10. * @{
  11. */
  12. /**
  13. * A GUIWidget specialization that when attached to a window will create a window border, window background and provide
  14. * resize functionality.
  15. */
  16. class WindowFrameWidget : public CGUIWidget
  17. {
  18. public:
  19. /**
  20. * Constructs a new window frame.
  21. *
  22. * @param[in] parent Parent SceneObject to attach the Component to.
  23. * @param[in] allowResize Should the widget set up resize handles that can be dragged by the user.
  24. * @param[in] camera Camera to draw the GUI elements in.
  25. * @param[in] ownerWindow Window that the frame widget will act on.
  26. * @param[in] skin GUI skin used for the GUI child elements.
  27. */
  28. WindowFrameWidget(const HSceneObject& parent, bool allowResize, const SPtr<Camera>& camera, RenderWindow* ownerWindow,
  29. const HGUISkin& skin);
  30. virtual ~WindowFrameWidget() = default;
  31. protected:
  32. /** @copydoc GUIWidget::ownerWindowFocusChanged */
  33. void ownerWindowFocusChanged() override;
  34. /** @copydoc GUIWidget::ownerTargetResized */
  35. void ownerTargetResized() override;
  36. /**
  37. * Updates the non-client areas that notify the OS where the interactable elements used for window resize
  38. * operations are. This should be called after any resize operations.
  39. */
  40. void refreshNonClientAreas() const;
  41. static const UINT32 RESIZE_BORDER_WIDTH;
  42. bool mAllowResize;
  43. GUIPanel* mWindowFramePanel;
  44. RenderWindow* mParentWindow;
  45. GUIWindowFrame* mWindowFrame;
  46. /************************************************************************/
  47. /* RTTI */
  48. /************************************************************************/
  49. public:
  50. friend class CWindowFrameWidgetRTTI;
  51. static RTTITypeBase* getRTTIStatic();
  52. RTTITypeBase* getRTTI() const override;
  53. WindowFrameWidget() { } // Serialization only
  54. };
  55. /** @} */
  56. }