BsGUIWindowFrameWidget.h 2.1 KB

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