/// Josh's User Interface Library /// A C++20 Library for creating, styling, and rendering of a UI/UX widgets. /// Developed and Maintained by Josh O'Leary @ Redacted Software. /// Special Thanks to William Tomasine II and Maxine Hayes. /// (c) 2024 Redacted Software /// This work is dedicated to the public domain. /// @file ScrollingRect.hpp /// @desc Scrolling Rectangle Widget /// @edit 2024-10-11 #pragma once #include #include #include "Hoverable.hpp" namespace JUI { struct ClickEventArgs { public: protected: private: }; struct ReleaseEventArgs { public: protected: private: }; /// A mixin helper class that provides behavior and events for clickable widgets. class Clickable { public: Event> Clicked; Event Released; Event OnClickEvent; Event OnReleaseEvent; public: [[nodiscard]] bool IsClicked() const { return clicked; }; void SetClicked(bool manual_click); public: virtual void OnClick(const Vector2& MousePos, const MouseButton& MouseButton);; virtual void OnRelease(const Vector2& MousePos, const MouseButton& MouseButton, bool MouseStillOver);; void Update(const Vector2& mpos, const MouseButton& btn, bool hovering); protected: bool clicked = false; bool click_debounce = false; }; }