BsGUIWindowFrameWidget.h 1.9 KB

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