30#include <TGUI/Widget.hpp>
53 typedef std::shared_ptr<Knob>
Ptr;
91 return std::static_pointer_cast<KnobRenderer>(m_renderer);
162 return m_startRotation;
174 return m_endRotation;
289 return m_clockwiseTurning;
316 virtual bool mouseOnWidget(
float x,
float y)
const override;
321 virtual void leftMousePressed(
float x,
float y)
override;
326 virtual void leftMouseReleased(
float x,
float y)
override;
331 virtual void mouseMoved(
float x,
float y)
override;
336 virtual void widgetFocused()
override;
345 void recalculateRotation();
360 virtual void reload(
const std::string& primary =
"",
const std::string& secondary =
"",
bool force =
false)
override;
368 return std::make_shared<Knob>(*
this);
375 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
381 bool m_clockwiseTurning =
true;
382 float m_startRotation = 270;
383 float m_endRotation = 270;
419 virtual void setProperty(std::string property,
const std::string& value)
override;
530 void draw(sf::RenderTarget& target, sf::RenderStates states)
const;
539 virtual std::shared_ptr<WidgetRenderer> clone(
Widget* widget)
override;
547 float m_imageRotation = 0;
551 sf::Color m_backgroundColor;
552 sf::Color m_thumbColor;
554 sf::Color m_borderColor;
Implicit converter for colors.
Definition: Color.hpp:40
virtual void setProperty(std::string property, ObjectConverter &&value) override
Change a property of the renderer.
virtual std::map< std::string, ObjectConverter > getPropertyValuePairs() const override
Get a map with all properties and their values.
KnobRenderer(Knob *knob)
Constructor.
Definition: Knob.hpp:407
void setForegroundTexture(const Texture &texture)
Change the foreground image of the knob.
void setThumbColor(const Color &color)
Changes the color of the thumb which you can move around the circle.
void setBorderColor(const Color &color)
Changes the color of the borders that are optionally drawn around the knob.
virtual void setProperty(std::string property, const std::string &value) override
Change a property of the renderer.
void setImageRotation(float rotation)
Changes the default rotation of the foreground image.
virtual ObjectConverter getProperty(std::string property) const override
Retrieve the value of a certain property.
void setBackgroundTexture(const Texture &texture)
Change the background image of the knob.
void setBackgroundColor(const Color &color)
Changes the color of the background.
Knob widget.
Definition: Knob.hpp:50
virtual sf::Vector2f getFullSize() const override
Returns the full size of the knob.
static Knob::Ptr create()
Creates a new knob widget.
std::shared_ptr< const Knob > ConstPtr
Shared constant widget pointer.
Definition: Knob.hpp:54
std::shared_ptr< Knob > Ptr
Shared widget pointer.
Definition: Knob.hpp:53
virtual void setPosition(const Layout2d &position) override
Set the position of the knob.
int getMinimum() const
Returns the value when the knob would be rotated in the direction of StartRotation.
Definition: Knob.hpp:236
void setEndRotation(float endRotation)
Set the end rotation, which is the place where the value should be maximal.
virtual Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Knob.hpp:366
virtual void setOpacity(float opacity) override
Changes the opacity of the widget.
bool getClockwiseTurning()
Returns whether the value increases when turning the knob clockwise?
Definition: Knob.hpp:287
virtual void setMaximum(int maximum)
Sets the value for when the knob would be rotated in the direction of EndRotation.
static Knob::Ptr copy(Knob::ConstPtr knob)
Makes a copy of another knob.
void setClockwiseTurning(bool clockwise)
Should the value increase when turning the knob clockwise?
int getValue() const
Returns the current value.
Definition: Knob.hpp:266
virtual sf::Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
std::shared_ptr< KnobRenderer > getRenderer() const
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Definition: Knob.hpp:89
virtual void setSize(const Layout2d &size) override
Changes the size of the knob.
virtual void setMinimum(int minimum)
Sets the value for when the knob would be rotated in the direction of StartRotation.
float getStartRotation()
Returns the start rotation, which is the place where the value should be minimal.
Definition: Knob.hpp:160
virtual void reload(const std::string &primary="", const std::string &secondary="", bool force=false) override
Reload the widget.
void setStartRotation(float startRotation)
Set the start rotation, which is the place where the value should be minimal.
virtual void setValue(int value)
Changes the current value.
int getMaximum() const
Returns the value when the knob would be rotated in the direction of EndRotation.
Definition: Knob.hpp:252
float getEndRotation()
Set the end rotation, which is the place where the value should be maximal.
Definition: Knob.hpp:172
Class to store the position or size of a widget.
Definition: Layout.hpp:255
Implicit converter for settable properties.
Definition: ObjectConverter.hpp:43
Definition: Texture.hpp:45
Namespace that contains all TGUI functions and classes.
Definition: Animation.hpp:34