25#ifndef TGUI_RANGE_SLIDER_HPP
26#define TGUI_RANGE_SLIDER_HPP
28#include <TGUI/Widget.hpp>
29#include <TGUI/Renderers/RangeSliderRenderer.hpp>
33TGUI_MODULE_EXPORT
namespace tgui
42 using Ptr = std::shared_ptr<RangeSlider>;
43 using ConstPtr = std::shared_ptr<const RangeSlider>;
45 static constexpr const char StaticWidgetType[] =
"RangeSlider";
54 RangeSlider(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
95 using Widget::setSize;
222 void leftMouseReleased(
Vector2f pos)
override;
227 void mouseMoved(
Vector2f pos)
override;
232 void leftMouseButtonNoLongerDown()
override;
266 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
271 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
276 TGUI_NODISCARD
Vector2f getInnerSize()
const;
281 void updateThumbPositions();
296 std::pair<FloatRect, FloatRect> m_thumbs;
299 unsigned int m_mouseDownOnThumb = 0;
303 float m_maximum = 10;
304 float m_selectionStart = 0;
305 float m_selectionEnd = 0;
308 Orientation m_orientation = Orientation::Horizontal;
309 Orientation m_imageOrientation = Orientation::Horizontal;
312 Sprite m_spriteTrackHover;
314 Sprite m_spriteThumbHover;
315 Sprite m_spriteSelectedTrack;
316 Sprite m_spriteSelectedTrackHover;
320 Color m_borderColorCached;
321 Color m_borderColorHoverCached;
322 Color m_thumbColorCached;
323 Color m_thumbColorHoverCached;
324 Color m_trackColorCached;
325 Color m_trackColorHoverCached;
326 Color m_selectedTrackColorCached;
327 Color m_selectedTrackColorHoverCached;
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Wrapper for colors.
Definition Color.hpp:73
Class to store the position or size of a widget.
Definition Layout.hpp:313
Definition Outline.hpp:38
Definition RangeSliderRenderer.hpp:35
RangeSlider widget.
Definition RangeSlider.hpp:39
TGUI_NODISCARD float getSelectionStart() const
Returns the current value where the selection starts.
TGUI_NODISCARD Vector2f getFullSize() const override
Returns the full size of the slider.
bool leftMousePressed(Vector2f pos) override
Called by the parent when the left mouse button goes down on top of the widget.
TGUI_NODISCARD float getSelectionEnd() const
Returns the current value where the selection ends.
void setSelectionStart(float value)
Changes the value where the selection starts.
std::shared_ptr< RangeSlider > Ptr
Shared widget pointer.
Definition RangeSlider.hpp:42
TGUI_NODISCARD Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
TGUI_NODISCARD RangeSliderRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void setMinimum(float minimum)
Sets a minimum value.
void setSize(const Layout2d &size) override
Changes the size of the slider.
TGUI_NODISCARD std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
void rendererChanged(const String &property) override
Function called when one of the properties of the renderer is changed.
TGUI_NODISCARD RangeSliderRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
static TGUI_NODISCARD RangeSlider::Ptr create(float minimum=0, float maximum=10)
Creates a new slider widget.
void setSelectionEnd(float value)
Changes the value where the selection ends.
void setMaximum(float maximum)
Sets a maximum value.
TGUI_NODISCARD float getMinimum() const
Returns the minimum value.
TGUI_NODISCARD Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
TGUI_NODISCARD float getStep() const
Returns the number of positions the thumb advances with each move.
TGUI_NODISCARD Signal & getSignal(String signalName) override
Retrieves a signal based on its name.
void setStep(float step)
Changes the number of positions the thumb advances with each move.
static TGUI_NODISCARD RangeSlider::Ptr copy(const RangeSlider::ConstPtr &slider)
Makes a copy of another slider.
TGUI_NODISCARD float getMaximum() const
Returns the maximum value.
TGUI_NODISCARD bool isMouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
std::shared_ptr< const RangeSlider > ConstPtr
Shared constant widget pointer.
Definition RangeSlider.hpp:43
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
Wrapper class to store strings.
Definition String.hpp:96
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
Orientation
Orientation of the object.
Definition Layout.hpp:51
States used for drawing.
Definition RenderStates.hpp:38