25#ifndef TGUI_SLIDER_HPP
26#define TGUI_SLIDER_HPP
28#include <TGUI/Widget.hpp>
29#include <TGUI/Renderers/SliderRenderer.hpp>
33TGUI_MODULE_EXPORT
namespace tgui
42 using Ptr = std::shared_ptr<Slider>;
43 using ConstPtr = std::shared_ptr<const Slider>;
45 static constexpr const char StaticWidgetType[] =
"Slider";
54 Slider(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
80 TGUI_NODISCARD
const SliderRenderer* getSharedRenderer()
const override;
98 using Widget::setSize;
201 TGUI_DEPRECATED(
"Use setOrientation instead") void setVerticalScroll(
bool vertical);
207 TGUI_DEPRECATED("Use getOrientation instead") TGUI_NODISCARD
bool getVerticalScroll() const;
230 void setInvertedDirection(
bool invertedDirection);
238 TGUI_NODISCARD
bool getInvertedDirection() const;
244 void setChangeValueOnScroll(
bool changeValueOnScroll);
250 TGUI_NODISCARD
bool getChangeValueOnScroll() const;
257 TGUI_NODISCARD
bool isMouseOnWidget(
Vector2f pos) const override;
267 void leftMouseReleased(
Vector2f pos) override;
272 void mouseMoved(
Vector2f pos) override;
277 bool scrolled(
float delta,
Vector2f pos,
bool touch) override;
282 void leftMouseButtonNoLongerDown() override;
311 void rendererChanged(const
String& property) override;
316 TGUI_NODISCARD std::unique_ptr<DataIO::Node> save(SavingRenderersMap& renderers) const override;
321 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
326 TGUI_NODISCARD
Vector2f getInnerSize() const;
331 void updateThumbPosition();
349 bool m_mouseDownOnThumb =
false;
353 float m_maximum = 10;
357 bool m_invertedDirection =
false;
358 bool m_changeValueOnScroll =
true;
360 Orientation m_orientation = Orientation::Horizontal;
361 Orientation m_imageOrientation = Orientation::Horizontal;
362 bool m_orientationLocked =
false;
365 Sprite m_spriteTrackHover;
367 Sprite m_spriteThumbHover;
371 Color m_borderColorCached;
372 Color m_borderColorHoverCached;
373 Color m_thumbColorCached;
374 Color m_thumbColorHoverCached;
375 Color m_trackColorCached;
376 Color m_trackColorHoverCached;
377 bool m_thumbWithinTrackCached =
false;
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:323
Definition Outline.hpp:38
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
Definition SliderRenderer.hpp:35
Slider widget.
Definition Slider.hpp:39
Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
static Slider::Ptr copy(const Slider::ConstPtr &slider)
Makes a copy of another slider.
SliderRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
float getStep() const
Returns the number of positions the thumb advances with each move.
void setMinimum(float minimum)
Sets a minimum value.
Vector2f getFullSize() const override
Returns the full size of the slider.
void setStep(float step)
Changes the number of positions the thumb advances with each move.
std::shared_ptr< Slider > Ptr
Shared widget pointer.
Definition Slider.hpp:42
SliderRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void setSize(const Layout2d &size) override
Changes the size of the slider.
static Slider::Ptr create(float minimum=0, float maximum=10)
Creates a new slider widget.
float getValue() const
Returns the current value.
float getMinimum() const
Returns the minimum value.
float getMaximum() const
Returns the maximum value.
void setValue(float value)
Changes the current value.
std::shared_ptr< const Slider > ConstPtr
Shared constant widget pointer.
Definition Slider.hpp:43
void setMaximum(float maximum)
Sets a maximum value.
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:52
States used for drawing.
Definition RenderStates.hpp:38