1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibGUI: Use calculated_preferred_size for Progressbar default size

This commit is contained in:
FrHun 2023-02-10 01:10:19 +01:00 committed by Sam Atkins
parent 6d79d932f9
commit f1271c7860
2 changed files with 11 additions and 0 deletions

View file

@ -27,6 +27,8 @@ Progressbar::Progressbar(Orientation orientation)
{ Format::ValueSlashMax, "ValueSlashMax" });
REGISTER_INT_PROPERTY("min", min, set_min);
REGISTER_INT_PROPERTY("max", max, set_max);
set_preferred_size(SpecialDimension::Fit);
}
void Progressbar::set_value(int value)
@ -81,4 +83,11 @@ void Progressbar::set_orientation(Orientation value)
update();
}
Optional<UISize> Progressbar::calculated_preferred_size() const
{
if (orientation() == Gfx::Orientation::Vertical)
return { { 22, SpecialDimension::OpportunisticGrow } };
return { { SpecialDimension::OpportunisticGrow, 22 } };
}
}