BSpinner: Simplify SetMin|MaxValue()

After the last change, korli suggested this simplification that lets
SetValue() do all the in/decrement-widget en/disabling.

Change-Id: If87579d9104bbc9ae279aa5f2f99c9921bb238ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7053
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
Humdinger 2023-10-18 11:06:33 +02:00 committed by Jérôme Duval
parent ac121994b1
commit de1e2d9227
2 changed files with 4 additions and 16 deletions

View File

@ -249,10 +249,7 @@ void
BDecimalSpinner::SetMinValue(double min)
{
fMinValue = min;
if (fValue < fMinValue)
SetValue(fMinValue);
else
SetDecrementEnabled(IsEnabled() && fValue > fMinValue);
SetValue(Value());
}
@ -260,10 +257,7 @@ void
BDecimalSpinner::SetMaxValue(double max)
{
fMaxValue = max;
if (fValue > fMaxValue)
SetValue(fMaxValue);
else
SetIncrementEnabled(IsEnabled() && fValue < fMaxValue);
SetValue(Value());
}

View File

@ -197,10 +197,7 @@ void
BSpinner::SetMinValue(int32 min)
{
fMinValue = min;
if (fValue < fMinValue)
SetValue(fMinValue);
else
SetDecrementEnabled(IsEnabled() && fValue > fMinValue);
SetValue(Value());
}
@ -208,10 +205,7 @@ void
BSpinner::SetMaxValue(int32 max)
{
fMaxValue = max;
if (fValue > fMaxValue)
SetValue(fMaxValue);
else
SetIncrementEnabled(IsEnabled() && fValue < fMaxValue);
SetValue(Value());
}