BsGUIWindowFrameWidget.h 2.2 KB

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