BsGUIHoverHitBox.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "GUI/BsGUIElementContainer.h"
  6. namespace bs
  7. {
  8. /** @addtogroup GUI-Editor
  9. * @{
  10. */
  11. /** Helper class used for detecting when mousing over a certain and getting notified when that state changes. */
  12. class BS_ED_EXPORT GUIHoverHitBox : public GUIElementContainer
  13. {
  14. public:
  15. /** Returns type name of the GUI element used for finding GUI element styles. */
  16. static const String& getGUITypeName();
  17. /** Creates a new hover hit box that will detect mouse hover/out events over certain area. */
  18. static GUIHoverHitBox* create();
  19. /** Creates a new hover hit box that will detect mouse hover/out events over certain area. */
  20. static GUIHoverHitBox* create(const GUIOptions& options);
  21. /** Triggered when pointer hovers over the hit box. */
  22. Event<void()> onHover;
  23. /** Triggered when pointer that was previously hovering leaves the hit box. */
  24. Event<void()> onOut;
  25. private:
  26. GUIHoverHitBox(const GUIDimensions& dimensions);
  27. /** @copydoc GUIElementContainer::updateClippedBounds */
  28. void updateClippedBounds() override;
  29. /** @copydoc GUIElementContainer::_mouseEvent */
  30. virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
  31. };
  32. /** @} */
  33. }