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

LibGUI: More GInputBox refinements.

Fix some GBoxLayout bugs to make the buttons in GInputBox line up better.
There are still some imperfections due to rounding errors.
This commit is contained in:
Andreas Kling 2019-03-19 03:00:42 +01:00
parent 46577a6948
commit e15cc4509f
3 changed files with 15 additions and 19 deletions

View file

@ -13,23 +13,6 @@ GBoxLayout::~GBoxLayout()
{
}
#if 0
Size GLayout::compute_preferred_size() const
{
}
static Size compute_preferred_size(GLayout::Entry& entry)
{
if (entry.layout)
return entry.layout->compute_preferred_size();
else {
return entry.widget->preferred_size();
}
}
#endif
void GBoxLayout::run(GWidget& widget)
{
bool should_log = false;
@ -59,14 +42,18 @@ void GBoxLayout::run(GWidget& widget)
printf("GBoxLayout: Subtracting for fixed %s{%p}, size: %s\n", entry.widget->class_name(), entry.widget.ptr(), entry.widget->preferred_size().to_string().characters());
printf("GBoxLayout: Available size before: %s\n", available_size.to_string().characters());
}
available_size -= entry.widget->preferred_size();
if (should_log)
printf("GBoxLayout: Available size after: %s\n", available_size.to_string().characters());
++number_of_entries_with_fixed_size;
}
available_size -= { spacing(), spacing() };
}
available_size += { spacing(), spacing() };
available_size -= { margins().left() + margins().right(), margins().top() + margins().bottom() };
if (should_log)
printf("GBoxLayout: Number of visible: %d/%d\n", number_of_visible_entries, m_entries.size());