26#ifndef TGUI_SPIN_CONTROL_HPP
27#define TGUI_SPIN_CONTROL_HPP
30#include <TGUI/SubwidgetContainer.hpp>
31#include <TGUI/Widgets/SpinButton.hpp>
32#include <TGUI/Widgets/EditBox.hpp>
45 typedef std::shared_ptr<SpinControl>
Ptr;
46 typedef std::shared_ptr<const SpinControl>
ConstPtr;
56 SpinControl(
const char* typeName =
"SpinControl",
bool initRenderer =
true);
70 static SpinControl::Ptr create(
float min = 0.0f,
float max = 10.0f,
float value = 0.0f,
unsigned int decimal = 0,
float step = 1.0f);
122 using SubwidgetContainer::setSize;
234 return std::make_shared<SpinControl>(*
this);
241 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
247 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
262 bool inRange(
const float value)
const;
280 unsigned int m_decimalPlaces = 0;
Definition EditBoxRenderer.hpp:37
std::shared_ptr< EditBox > Ptr
Shared widget pointer.
Definition EditBox.hpp:49
Class to store the position or size of a widget.
Definition Layout.hpp:262
Spin control widget.
Definition SpinControl.hpp:42
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.
float getMaximum() const
Returns the maximum value.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition SpinControl.hpp:232
float getMinimum() const
Returns the minimum value.
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.
EditBoxRenderer * getSpinTextRenderer()
Returns the renderer of edit box part of widget.
static SpinControl::Ptr copy(SpinControl::ConstPtr SpinCtrl)
Makes a copy of another spin control.
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:45
std::shared_ptr< const SpinControl > ConstPtr
Shared constant widget pointer.
Definition SpinControl.hpp:46
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.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
float getStep() const
Returns the number of positions the thumb advances with each move.
Wrapper class to store strings.
Definition String.hpp:79
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36