25#ifndef TGUI_SPIN_CONTROL_HPP
26#define TGUI_SPIN_CONTROL_HPP
28#include <TGUI/SubwidgetContainer.hpp>
29#include <TGUI/Widgets/SpinButton.hpp>
30#include <TGUI/Widgets/EditBox.hpp>
34TGUI_MODULE_EXPORT
namespace tgui
43 using Ptr = std::shared_ptr<SpinControl>;
44 using ConstPtr = std::shared_ptr<const SpinControl>;
46 static constexpr const char StaticWidgetType[] =
"SpinControl";
55 SpinControl(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
88 TGUI_NODISCARD
static SpinControl::Ptr create(
float min = 0.0f,
float max = 10.0f,
float value = 0.0f,
unsigned int decimal = 0,
float step = 1.0f);
118 TGUI_NODISCARD
const EditBoxRenderer* getSpinTextSharedRenderer()
const;
133 using SubwidgetContainer::setSize;
230 TGUI_DEPRECATED(
"Use setSpinButtonWidth(\"100%\") or setSpinButtonWidth(\"50%\") instead") void setUseWideArrows(
bool useWideArrows);
236 TGUI_DEPRECATED("Use getSpinButtonWidth() instead") TGUI_NODISCARD
bool getUseWideArrows() const;
254 TGUI_NODISCARD
float getSpinButtonWidth() const;
278 TGUI_NODISCARD std::unique_ptr<DataIO::Node> save(SavingRenderersMap& renderers) const override;
283 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
296 bool inRange(const
float value) const;
301 void setString(const
String& str);
311 unsigned int m_decimalPlaces = 0;
312 bool m_useWideArrows =
false;
Class to store the a value that is either a constant or a ratio.
Definition AbsoluteOrRelativeValue.hpp:45
Definition EditBoxRenderer.hpp:35
std::shared_ptr< EditBox > Ptr
Shared widget pointer.
Definition EditBox.hpp:51
Class to store the position or size of a widget.
Definition Layout.hpp:323
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
Spin control widget.
Definition SpinControl.hpp:40
SpinButtonRenderer * getSpinButtonSharedRenderer()
Returns the renderer of spin buttons part of widget.
EditBoxRenderer * getSpinTextSharedRenderer()
Returns the renderer of edit box part of widget.
void setMaximum(float maximum)
Sets a maximum value.
static SpinControl::Ptr copy(const SpinControl::ConstPtr &SpinCtrl)
Makes a copy of another spin control.
float getMaximum() const
Returns the maximum value.
SpinControl(const SpinControl ©)
Copy constructor.
std::shared_ptr< const SpinControl > ConstPtr
Shared constant widget pointer.
Definition SpinControl.hpp:44
float getMinimum() const
Returns the minimum value.
EditBoxRenderer * getSpinTextRenderer()
Returns the renderer of edit box part of widget.
SpinControl(SpinControl &©) noexcept
Move constructor.
unsigned int getDecimalPlaces() const
Returns the number of decimal places to display.
static SpinControl::Ptr create(float min=0.0f, float max=10.0f, float value=0.0f, unsigned int decimal=0, float step=1.0f)
Creates a new spin button widget.
void setSize(const Layout2d &size) override
Changes the size of the spin control.
void setMinimum(float minimum)
Sets a minimum value.
void setStep(float step)
Changes how much the value changes on each arrow press.
std::shared_ptr< SpinControl > Ptr
Shared widget pointer.
Definition SpinControl.hpp:43
SpinButtonRenderer * getSpinButtonRenderer()
Returns the renderer of spin buttons part of widget.
void setDecimalPlaces(unsigned int decimalPlaces)
Changes the number of decimal places to display.
bool setValue(float value)
Changes the current value.
float getValue() const
Returns the current value.
float getStep() const
Returns the number of positions the thumb advances with each move.
Wrapper class to store strings.
Definition String.hpp:96
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38