26#ifndef TGUI_SLIDER_HPP
27#define TGUI_SLIDER_HPP
30#include <TGUI/Widget.hpp>
31#include <TGUI/Renderers/SliderRenderer.hpp>
44 typedef std::shared_ptr<Slider>
Ptr;
45 typedef std::shared_ptr<const Slider>
ConstPtr;
276 void leftMousePressed(
Vector2f pos)
override;
281 void leftMouseReleased(
Vector2f pos)
override;
286 void mouseMoved(
Vector2f pos)
override;
291 bool mouseWheelScrolled(
float delta,
Vector2f pos)
override;
296 void leftMouseButtonNoLongerDown()
override;
306 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
336 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
342 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
354 void updateThumbPosition();
362 return std::make_shared<Slider>(*
this);
369 SignalFloat onValueChange = {
"ValueChanged"};
378 bool m_mouseDownOnThumb =
false;
382 float m_maximum = 10;
386 bool m_invertedDirection =
false;
387 bool m_verticalScroll =
false;
388 bool m_verticalImage =
false;
389 bool m_changeValueOnScroll =
true;
392 Sprite m_spriteTrackHover;
394 Sprite m_spriteThumbHover;
398 Color m_borderColorCached;
399 Color m_borderColorHoverCached;
400 Color m_thumbColorCached;
401 Color m_thumbColorHoverCached;
402 Color m_trackColorCached;
403 Color m_trackColorHoverCached;
Wrapper for colors.
Definition: Color.hpp:49
Definition: FloatRect.hpp:37
Class to store the position or size of a widget.
Definition: Layout.hpp:260
Definition: Outline.hpp:39
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:231
Definition: SliderRenderer.hpp:37
Slider widget.
Definition: Slider.hpp:41
SliderRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
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.
std::shared_ptr< Slider > Ptr
Shared widget pointer.
Definition: Slider.hpp:44
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
bool getVerticalScroll() const
Returns whether the slider lies horizontally or vertically.
Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
bool getChangeValueOnScroll() const
Returns whether the mouse wheel can be used to change the value of the slider.
bool getInvertedDirection() const
Returns whether the side of the slider that is the minimum and maximum is inverted.
bool mouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Slider.hpp:360
float getStep() const
Returns the number of positions the thumb advances with each move.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
void setVerticalScroll(bool vertical)
Changes whether the slider lies horizontally or vertically.
void setMinimum(float minimum)
Sets a minimum value.
std::shared_ptr< const Slider > ConstPtr
Shared constant widget pointer.
Definition: Slider.hpp:45
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.
void setChangeValueOnScroll(bool changeValueOnScroll)
Changes whether the mouse wheel can be used to change the value of the slider.
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.
SliderRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void setValue(float value)
Changes the current value.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
void setInvertedDirection(bool invertedDirection)
Changes whether the side of the slider that is the minimum and maximum should be inverted.
void setMaximum(float maximum)
Sets a maximum value.
static Slider::Ptr copy(Slider::ConstPtr slider)
Makes a copy of another slider.
Definition: Sprite.hpp:46
Definition: Vector2f.hpp:39
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37