14#include <AUI/Traits/values.h>
15#include <AUI/Util/ADataBinding.h>
17#include "AAbstractTextField.h"
18#include "AViewContainer.h"
24class API_AUI_VIEWS ADoubleNumberPicker :
public AViewContainerBase {
28 ADoubleNumberPicker& mPicker;
31 ADoubleNumberPickerField(::ADoubleNumberPicker& picker) : mPicker(picker) {}
33 virtual ~ADoubleNumberPickerField() =
default;
35 void onKeyRepeat(AInput::Key key)
override;
38 bool isValidText(
const AString& text)
override;
47 ADoubleNumberPicker();
52 &ADoubleNumberPicker::getValue,
53 &ADoubleNumberPicker::setValue,
58 void setValue(
double v);
60 void setSuffix(
const AString& suffix);
62 [[nodiscard]]
const AString& text()
const noexcept {
return mTextField->text(); }
64 [[nodiscard]]
double getValue()
const {
return mTextField->getText().
toDouble().valueOr(0.0); }
66 [[nodiscard]]
double getMin()
const {
return mMin; }
68 [[nodiscard]]
double getMax()
const {
return mMax; }
70 void setMin(
double min);
71 void setMax(
double max);
75 void changeBy(
double v);
90template <
typename Num>
97 static auto getSetter() {
return &ADoubleNumberPicker::setValue; }
100template <aui::arithmetic UnderlyingType, auto min, auto max>
105 view->setMin(aui::ranged_number<UnderlyingType, min, max>::MIN);
106 view->setMax(aui::ranged_number<UnderlyingType, min, max>::MAX);
111 static auto getSetter() {
return &ADoubleNumberPicker::setValue; }
121template <aui::arithmetic UnderlyingType, auto min, auto max>
Text field implementation.
Definition AAbstractTextField.h:26
A text field for numbers with increase/decrease buttons.
Definition ADoubleNumberPicker.h:24
emits< double > valueChanging
Number is changing.
Definition ADoubleNumberPicker.h:86
emits< double > valueChanged
Number changed.
Definition ADoubleNumberPicker.h:81
Represents a Unicode character string.
Definition AString.h:38
AOptional< double > toDouble() const noexcept
Converts the string to a double number.
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:572
Defines how View handles properties of FieldType type.
Definition ADataBinding.h:37
Property implementation to use with custom getter/setter.
Definition AProperty.h:234
Definition ADoubleNumberPicker.h:91
Definition ADoubleNumberPicker.h:102