1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

LibGUI+Apps: Let Splitters select which resizee to set fixed

This gives Splitters more versatility when the right resizee is
intended to remain fixed or be toggled on and off.
This commit is contained in:
thankyouverycool 2022-02-20 08:07:31 -05:00 committed by Idan Horowitz
parent 495fd1d2c4
commit c3ce562240
5 changed files with 22 additions and 4 deletions

View file

@ -20,6 +20,9 @@ Splitter::Splitter(Orientation orientation)
{
REGISTER_INT_PROPERTY("first_resizee_minimum_size", first_resizee_minimum_size, set_first_resizee_minimum_size);
REGISTER_INT_PROPERTY("second_resizee_minimum_size", second_resizee_minimum_size, set_second_resizee_minimum_size);
REGISTER_ENUM_PROPERTY("fixed_resizee", fixed_resizee, set_fixed_resizee, FixedResizee,
{ FixedResizee::First, "First" },
{ FixedResizee::Second, "Second" });
set_background_role(ColorRole::Button);
set_layout<BoxLayout>(orientation);
@ -218,11 +221,11 @@ void Splitter::mousemove_event(MouseEvent& event)
}
if (m_orientation == Orientation::Horizontal) {
m_first_resizee->set_fixed_width(new_first_resizee_size.width());
m_second_resizee->set_fixed_width(-1);
m_first_resizee->set_fixed_width(fixed_resizee() == FixedResizee::First ? new_first_resizee_size.width() : -1);
m_second_resizee->set_fixed_width(fixed_resizee() == FixedResizee::Second ? new_second_resizee_size.width() : -1);
} else {
m_first_resizee->set_fixed_height(new_first_resizee_size.height());
m_second_resizee->set_fixed_height(-1);
m_first_resizee->set_fixed_height(fixed_resizee() == FixedResizee::First ? new_first_resizee_size.height() : -1);
m_second_resizee->set_fixed_height(fixed_resizee() == FixedResizee::Second ? new_second_resizee_size.height() : -1);
}
invalidate_layout();