26#ifndef TGUI_SLIDER_HPP
27#define TGUI_SLIDER_HPP
30#include <TGUI/Widget.hpp>
53 typedef std::shared_ptr<Slider>
Ptr;
54 typedef std::shared_ptr<const Slider>
ConstPtr;
94 return std::static_pointer_cast<SliderRenderer>(m_renderer);
238 virtual bool mouseOnWidget(
float x,
float y)
const override;
243 virtual void leftMousePressed(
float x,
float y)
override;
248 virtual void leftMouseReleased(
float x,
float y)
override;
253 virtual void mouseMoved(
float x,
float y)
override;
258 virtual void mouseWheelMoved(
int delta,
int x,
int y)
override;
263 virtual void widgetFocused()
override;
268 virtual void mouseNoLongerDown()
override;
286 virtual void reload(
const std::string& primary =
"",
const std::string& secondary =
"",
bool force =
false)
override;
294 return std::make_shared<Slider>(*
this);
301 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
307 sf::FloatRect m_thumb;
310 bool m_mouseDownOnThumb =
false;
311 sf::Vector2f m_mouseDownOnThumbPos;
318 bool m_verticalScroll =
false;
321 bool m_verticalImage =
false;
352 virtual void setProperty(std::string property,
const std::string& value)
override;
525 void draw(sf::RenderTarget& target, sf::RenderStates states)
const;
534 virtual std::shared_ptr<WidgetRenderer> clone(
Widget* widget)
override;
547 sf::Color m_trackColorNormal;
548 sf::Color m_trackColorHover;
550 sf::Color m_thumbColorNormal;
551 sf::Color m_thumbColorHover;
553 sf::Color m_borderColor;
Implicit converter for colors.
Definition: Color.hpp:40
Class to store the position or size of a widget.
Definition: Layout.hpp:255
Implicit converter for settable properties.
Definition: ObjectConverter.hpp:43
Definition: Slider.hpp:331
void setBorderColor(const Color &color)
Changes the color of the borders.
void setThumbHoverTexture(const Texture &texture)
Change the image of the thumb that is displayed when the mouse is on top of the slider.
virtual std::map< std::string, ObjectConverter > getPropertyValuePairs() const override
Get a map with all properties and their values.
void setTrackTexture(const Texture &texture)
Change the image of the track that is displayed when the mouse is not on top of the slider.
void setThumbColorHover(const Color &color)
Changes the color of the thumb in hover state (mouse on slider).
void setTrackColor(const Color &color)
Changes the color of the track.
virtual void setProperty(std::string property, ObjectConverter &&value) override
Change a property of the renderer.
SliderRenderer(Slider *slider)
Constructor.
Definition: Slider.hpp:340
virtual ObjectConverter getProperty(std::string property) const override
Retrieve the value of a certain property.
void setThumbColor(const Color &color)
Changes the color of the thumb.
void setTrackColorNormal(const Color &color)
Changes the color of the track in the normal state (mouse not on slider).
void setTrackColorHover(const Color &color)
Changes the color of the track in hover state (mouse on slider).
void setTrackHoverTexture(const Texture &texture)
Change the image of the track that is displayed when the mouse is on top of the slider.
virtual void setProperty(std::string property, const std::string &value) override
Change a property of the renderer.
void setThumbTexture(const Texture &texture)
Change the image of the thumb that is displayed when the mouse is not on top of the slider.
void setThumbColorNormal(const Color &color)
Changes the color of the thumb in the normal state (mouse not on slider).
Slider widget.
Definition: Slider.hpp:50
std::shared_ptr< Slider > Ptr
Shared widget pointer.
Definition: Slider.hpp:53
int getMinimum() const
Returns the minimum value.
Definition: Slider.hpp:181
virtual void setOpacity(float opacity) override
Changes the opacity of the widget.
virtual void setPosition(const Layout2d &position) override
Set the position of the widget.
int getValue() const
Returns the current value.
Definition: Slider.hpp:209
virtual void setValue(int value)
Changes the current value.
virtual void setMaximum(int maximum)
Sets a maximum value.
virtual sf::Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
virtual sf::Vector2f getFullSize() const override
Returns the full size of the slider.
std::shared_ptr< SliderRenderer > getRenderer() const
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Definition: Slider.hpp:92
std::shared_ptr< const Slider > ConstPtr
Shared constant widget pointer.
Definition: Slider.hpp:54
int getMaximum() const
Returns the maximum value.
Definition: Slider.hpp:195
virtual void setMinimum(int minimum)
Sets a minimum value.
void setSize(const Layout2d &size) override
Changes the size of the slider.
virtual Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Slider.hpp:292
static Slider::Ptr create(int minimum=0, int maximum=10)
Creates a new slider widget.
virtual void reload(const std::string &primary="", const std::string &secondary="", bool force=false) override
Reload the widget.
static Slider::Ptr copy(Slider::ConstPtr slider)
Makes a copy of another slider.
Definition: Texture.hpp:45
Namespace that contains all TGUI functions and classes.
Definition: Animation.hpp:34