26#ifndef TGUI_RANGE_SLIDER_HPP
27#define TGUI_RANGE_SLIDER_HPP
30#include <TGUI/Widget.hpp>
31#include <TGUI/Renderers/RangeSliderRenderer.hpp>
44 typedef std::shared_ptr<RangeSlider>
Ptr;
45 typedef std::shared_ptr<const RangeSlider>
ConstPtr;
246 void leftMousePressed(
Vector2f pos)
override;
251 void leftMouseReleased(
Vector2f pos)
override;
256 void mouseMoved(
Vector2f pos)
override;
261 void leftMouseButtonNoLongerDown()
override;
271 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
301 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
307 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
319 void updateThumbPositions();
327 return std::make_shared<RangeSlider>(*
this);
340 std::pair<FloatRect, FloatRect> m_thumbs;
343 unsigned int m_mouseDownOnThumb = 0;
347 float m_maximum = 10;
348 float m_selectionStart = 0;
349 float m_selectionEnd = 0;
353 bool m_verticalScroll =
false;
356 bool m_verticalImage =
false;
359 Sprite m_spriteTrackHover;
361 Sprite m_spriteThumbHover;
365 Color m_borderColorCached;
366 Color m_borderColorHoverCached;
367 Color m_thumbColorCached;
368 Color m_thumbColorHoverCached;
369 Color m_trackColorCached;
370 Color m_trackColorHoverCached;
371 Color m_selectedTrackColorCached;
372 Color m_selectedTrackColorHoverCached;
Wrapper for colors.
Definition: Color.hpp:49
Class to store the position or size of a widget.
Definition: Layout.hpp:260
Definition: Outline.hpp:39
Definition: RangeSliderRenderer.hpp:37
RangeSlider widget.
Definition: RangeSlider.hpp:41
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
float getMinimum() const
Returns the minimum value.
Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
float getStep() const
Returns the number of positions the thumb advances with each move.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
float getSelectionEnd() const
Returns the current value where the selection ends.
void setSelectionStart(float value)
Changes the value where the selection starts.
Vector2f getFullSize() const override
Returns the full size of the slider.
void setMinimum(float minimum)
Sets a minimum value.
void setSize(const Layout2d &size) override
Changes the size of the slider.
float getSelectionStart() const
Returns the current value where the selection starts.
RangeSliderRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
static RangeSlider::Ptr copy(RangeSlider::ConstPtr slider)
Makes a copy of another slider.
std::shared_ptr< const RangeSlider > ConstPtr
Shared constant widget pointer.
Definition: RangeSlider.hpp:45
static RangeSlider::Ptr create(float minimum=0, float maximum=10)
Creates a new slider widget.
std::shared_ptr< RangeSlider > Ptr
Shared widget pointer.
Definition: RangeSlider.hpp:44
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 setSelectionEnd(float value)
Changes the value where the selection ends.
bool mouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
void setMaximum(float maximum)
Sets a maximum value.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: RangeSlider.hpp:325
RangeSliderRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
float getMaximum() const
Returns the maximum value.
void setStep(float step)
Changes the number of positions the thumb advances with each move.
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:452
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:231
Definition: Sprite.hpp:46
Definition: Vector2f.hpp:39
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37