BsGUIWindowFrameWidget.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIWidget.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 GUIWidget
  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 target Viewport 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, Viewport* target, 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 bool _mouseEvent(GUIElement* element, const GUIMouseEvent& ev) override;
  35. /**
  36. * @copydoc GUIWidget::ownerWindowFocusChanged
  37. */
  38. virtual void ownerWindowFocusChanged() override;
  39. /**
  40. * @copydoc GUIWidget::ownerTargetResized
  41. */
  42. virtual void ownerTargetResized() override;
  43. /**
  44. * @brief Updates the non-client areas that notify the OS where the interactable elements
  45. * used for window resize operations are. This should be called after any resize
  46. * operations.
  47. */
  48. void refreshNonClientAreas() const;
  49. static const UINT32 RESIZE_BORDER_WIDTH;
  50. bool mAllowResize;
  51. GUIPanel* mWindowFramePanel;
  52. RenderWindow* mParentWindow;
  53. GUIWindowFrame* mWindowFrame;
  54. };
  55. }