mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
CtrlLib, Core: Improved float support (EditFloatSpin, Value::operator float)
This commit is contained in:
parent
45440d75b5
commit
a199280088
5 changed files with 21 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ GUI_APP_MAIN
|
|||
RDUMP(sizeof(Image));
|
||||
RDUMP(sizeof(RichText));
|
||||
RDUMP(sizeof(Ctrl::LogPos));
|
||||
RDUMP(sizeof(LabelBase));
|
||||
RLOG("=============");
|
||||
RDUMP(sizeof(Ctrl));
|
||||
RDUMP(sizeof(ScrollBar));
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ public:
|
|||
operator Date() const { return Is(DATE_V) ? GetSmallRaw<Date>() : GetOtherDate(); }
|
||||
operator Time() const { return Is(TIME_V) ? GetSmallRaw<Time>() : GetOtherTime(); }
|
||||
operator double() const { return Is(DOUBLE_V) ? GetSmallRaw<double>() : GetOtherDouble(); }
|
||||
operator float() const { return float(Is(DOUBLE_V) ? GetSmallRaw<double>() : GetOtherDouble()); }
|
||||
operator int() const { return Is(INT_V) ? GetSmallRaw<int>() : GetOtherInt(); }
|
||||
operator int64() const { return Is(INT64_V) ? GetSmallRaw<int64>() : GetOtherInt64(); }
|
||||
operator bool() const { return Is(BOOL_V) ? GetSmallRaw<bool>() : GetOtherBool(); }
|
||||
|
|
|
|||
|
|
@ -970,6 +970,19 @@ ctrl EditDoubleSpin {
|
|||
}
|
||||
}
|
||||
|
||||
ctrl EditFloatSpin {
|
||||
>EditDoubleSpin;
|
||||
|
||||
Paint(w) {
|
||||
r = GetRect();
|
||||
DrawCtrlFrame(w, r, .SetFrame);
|
||||
w.DrawRect(r, :SWhite);
|
||||
DrawSpinButtons(w, r);
|
||||
PaintMinMaxText(w, "flt", DblStr(.Min), DblStr(.Max), "+-" + DblStr(.SetInc));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ctrl EditDateSpin {
|
||||
>EditDate;
|
||||
|
||||
|
|
|
|||
|
|
@ -526,11 +526,14 @@ void WithSpin<DataType, Base, IncType>::MouseWheel(Point, int zdelta, dword)
|
|||
typedef WithSpin<int, EditInt> EditIntSpin;
|
||||
typedef WithSpin<int64, EditInt64> EditInt64Spin;
|
||||
typedef WithSpin<double, EditDouble> EditDoubleSpin;
|
||||
typedef WithSpin<double, EditFloat> EditFloatSpin;
|
||||
typedef WithSpin<Date, EditDate, int> EditDateSpin;
|
||||
typedef WithSpin<Time, EditTime, int> EditTimeSpin;
|
||||
|
||||
typedef WithSpin<int, EditIntNotNull> EditIntNotNullSpin;
|
||||
typedef WithSpin<int64, EditInt64NotNull> EditInt64NotNullSpin;
|
||||
typedef WithSpin<double, EditDoubleNotNull> EditDoubleNotNullSpin;
|
||||
typedef WithSpin<double, EditFloatNotNull> EditFloatNotNullSpin;
|
||||
typedef WithSpin<Date, EditDateNotNull, int> EditDateNotNullSpin;
|
||||
typedef WithSpin<Time, EditTimeNotNull, int> EditTimeNotNullSpin;
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,8 @@ tons][@(0.0.255) `&]_[* SpinButtonsObject]()_[@(0.0.255) const]&]
|
|||
4], [_^EditInt64^ EditInt64]>_[* EditInt64Spin]&]
|
||||
[s5;:EditDoubleSpin`:`:typedef:%- [@(0.0.255) typedef]_[_^WithSpin^ WithSpin]<[@(0.0.255) d
|
||||
ouble], [_^EditDouble^ EditDouble]>_[* EditDoubleSpin]&]
|
||||
[s5;:Upp`:`:EditFloatSpin`:`:typedef:%- [@(0.0.255) typedef]_[_^Upp`:`:WithSpin^ WithSpin
|
||||
]<[@(0.0.255) float], [_^Upp`:`:EditFloat^ EditFloat]>_[* EditFloatSpin]&]
|
||||
[s5;:EditDateSpin`:`:typedef:%- [@(0.0.255) typedef]_[_^WithSpin^ WithSpin]<[_^Date^ Date],
|
||||
[_^EditDate^ EditDate], [@(0.0.255) int]>_[* EditDateSpin]&]
|
||||
[s5;:EditTimeSpin`:`:typedef:%- [@(0.0.255) typedef]_[_^WithSpin^ WithSpin]<[_^Time^ Time],
|
||||
|
|
@ -127,4 +129,5 @@ ate], [_^EditDateNotNull^ EditDateNotNull], [@(0.0.255) int]>_[* EditDateNotNull
|
|||
ime], [_^EditTimeNotNull^ EditTimeNotNull], [@(0.0.255) int]>_[* EditTimeNotNullSpin]&]
|
||||
[s2; These typedefs predefine common EditField based value editors
|
||||
with spin buttons.&]
|
||||
[s3;%- &]
|
||||
[s3; ]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue