30#include <TGUI/Widget.hpp>
31#include <TGUI/Renderers/KnobRenderer.hpp>
44 typedef std::shared_ptr<Knob>
Ptr;
254 void leftMousePressed(
Vector2f pos)
override;
259 void leftMouseReleased(
Vector2f pos)
override;
264 void mouseMoved(
Vector2f pos)
override;
274 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
304 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
310 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
322 void recalculateRotation();
330 return std::make_shared<Knob>(*
this);
337 SignalInt onValueChange = {
"ValueChanged"};
343 bool m_clockwiseTurning =
true;
344 float m_startRotation = 270;
345 float m_endRotation = 270;
353 Sprite m_spriteBackground;
354 Sprite m_spriteForeground;
358 Color m_borderColorCached;
359 Color m_backgroundColorCached;
360 Color m_thumbColorCached;
361 float m_imageRotationCached = 0;
Wrapper for colors.
Definition: Color.hpp:49
Definition: KnobRenderer.hpp:37
Knob widget.
Definition: Knob.hpp:41
static Knob::Ptr create()
Creates a new knob widget.
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
std::shared_ptr< const Knob > ConstPtr
Shared constant widget pointer.
Definition: Knob.hpp:45
std::shared_ptr< Knob > Ptr
Shared widget pointer.
Definition: Knob.hpp:44
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
int getMinimum() const
Returns the value when the knob would be rotated in the direction of StartRotation.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
float getEndRotation() const
Sets the end rotation, which is the place where the value should be maximal.
KnobRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
float getStartRotation() const
Returns the start rotation, which is the place where the value should be minimal.
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 setEndRotation(float endRotation)
Sets the end rotation, which is the place where the value should be maximal.
KnobRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
static Knob::Ptr copy(Knob::ConstPtr knob)
Makes a copy of another knob.
void setValue(int value)
Changes the current value.
void setClockwiseTurning(bool clockwise)
Should the value increase when turning the knob clockwise?
int getValue() const
Returns the current value.
bool getClockwiseTurning() const
Returns whether the value increases when turning the knob clockwise?
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Knob.hpp:328
void setSize(const Layout2d &size) override
Changes the size of the knob.
void setMaximum(int maximum)
Sets the value for when the knob would be rotated in the direction of EndRotation.
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 setStartRotation(float startRotation)
Sets the start rotation, which is the place where the value should be minimal.
int getMaximum() const
Returns the value when the knob would be rotated in the direction of EndRotation.
void setMinimum(int minimum)
Sets the value for when the knob would be rotated in the direction of StartRotation.
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: Sprite.hpp:46
Definition: Vector2f.hpp:39
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37