Files
ReJUI/include/JUI/Mixins/Toggleable.hpp
2024-12-04 14:41:53 -05:00

33 lines
937 B
C++

/// 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 Toggleable.hpp
/// @desc Toggleable Mixin Helper Class - Added to widgets that should have special behavior when hovered by the mouse.
/// @edit 2024-10-11
#pragma once
#include <Event.h>
namespace JUI
{
/// A mixin helper class that provides behavior and events for a binary-state togglable widget.
class Toggleable {
public:
Event<> OnToggleEvent;
Event<> OnToggleOnEvent;
Event<> OnToggleOffEvent;
public:
virtual void OnToggleOn();
virtual void OnToggleOff();
virtual void Update();
protected:
bool toggled = false;
};
}