2021-08-06 14:22:56 +02:00
|
|
|
#ifndef BWIDGETS_NUMERIC_INPUT_HPP
|
|
|
|
#define BWIDGETS_NUMERIC_INPUT_HPP
|
2021-07-18 18:26:12 +02:00
|
|
|
|
|
|
|
#include <basic_widgets/core/type/concepts.hpp>
|
|
|
|
#include <basic_widgets/w/base/input.hpp>
|
|
|
|
|
2021-08-06 14:22:56 +02:00
|
|
|
namespace bwidgets
|
2021-07-18 18:26:12 +02:00
|
|
|
{
|
2021-08-06 14:22:56 +02:00
|
|
|
template<Numeric T>
|
2021-08-17 18:00:27 +02:00
|
|
|
class NumericInput : public virtual Input<T>
|
2021-07-18 18:26:12 +02:00
|
|
|
{
|
2021-07-29 16:06:03 +02:00
|
|
|
public:
|
2021-08-23 23:50:14 +02:00
|
|
|
// Button increment/decrement step.
|
2021-07-29 16:06:03 +02:00
|
|
|
T button_step = 1;
|
2021-07-18 18:26:12 +02:00
|
|
|
|
2021-08-23 23:50:14 +02:00
|
|
|
// Get allowed value range.
|
2021-08-17 18:00:27 +02:00
|
|
|
[[nodiscard]] virtual auto value_range() const noexcept
|
|
|
|
-> const std::pair<T, T>& = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// Set allowed value range.
|
2021-08-17 18:00:27 +02:00
|
|
|
virtual void value_range(T min, T max) = 0;
|
2021-07-18 18:26:12 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|