R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ISlider.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** r-type
4** File description:
5** ISlider - Abstract slider interface for UI system
6*/
7
8#pragma once
9
10#include <functional>
11#include <string>
12
13namespace UI {
17 enum class Align;
18
30 class ISlider {
31 public:
35 virtual ~ISlider() = default;
36
41 virtual void Update() = 0;
42
47 virtual void Render() = 0;
48
53 virtual void SetOnValueChanged(std::function<void(float)> callback) = 0;
54
60 virtual void SetPosition(float x, float y) = 0;
61
67 virtual void GetPosition(float &x, float &y) const = 0;
68
74 virtual void SetSize(float width, float height) = 0;
75
81 virtual void GetSize(float &width, float &height) const = 0;
82
87 virtual void SetTrackColor(unsigned int color) = 0;
88
93 virtual void SetFilledColor(unsigned int color) = 0;
94
99 virtual void SetHandleColor(unsigned int color) = 0;
100
105 virtual void SetHandleHoverColor(unsigned int color) = 0;
106
111 virtual void SetMinValue(float minValue) = 0;
112
117 virtual void SetMaxValue(float maxValue) = 0;
118
123 virtual void SetValue(float value) = 0;
124
129 [[nodiscard]] virtual float GetValue() const = 0;
130
135 virtual void SetAlign(Align align) = 0;
136
141 [[nodiscard]] virtual Align GetAlign() const = 0;
142
147 virtual void ApplyAlignment() = 0;
148
153 virtual void SetEnabled(bool enabled) = 0;
154
159 [[nodiscard]] virtual bool IsEnabled() const = 0;
160 };
161} // namespace UI
Abstract interface for UI sliders.
Definition ISlider.hpp:30
virtual float GetValue() const =0
Get the current value.
virtual void SetEnabled(bool enabled)=0
Enable or disable the slider.
virtual void SetAlign(Align align)=0
Set alignment mode relative to the window.
virtual void GetPosition(float &x, float &y) const =0
Get the current top-left position of the slider.
virtual Align GetAlign() const =0
Get the current alignment mode.
virtual void SetMaxValue(float maxValue)=0
Set the maximum value.
virtual ~ISlider()=default
Virtual destructor.
virtual void GetSize(float &width, float &height) const =0
Get the current size of the slider.
virtual void SetValue(float value)=0
Set the current value.
virtual void SetTrackColor(unsigned int color)=0
Set the track color (unfilled portion).
virtual void SetOnValueChanged(std::function< void(float)> callback)=0
Set callback invoked when value changes.
virtual void SetMinValue(float minValue)=0
Set the minimum value.
virtual void Render()=0
Render the slider.
virtual void ApplyAlignment()=0
Apply the current alignment mode to the position.
virtual void SetPosition(float x, float y)=0
Set the top-left position of the slider.
virtual void Update()=0
Update the slider internal state (hover, drag).
virtual void SetFilledColor(unsigned int color)=0
Set the filled track color (portion before handle).
virtual bool IsEnabled() const =0
Check if the slider is enabled.
virtual void SetHandleColor(unsigned int color)=0
Set the handle color.
virtual void SetSize(float width, float height)=0
Set the slider size.
virtual void SetHandleHoverColor(unsigned int color)=0
Set the handle hover color.
Definition IButton.hpp:13
Align
Alignment modes relative to the current window.
Definition IButton.hpp:33