BsGUIWindowFrameWidget.h 2.2 KB

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