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

PixelPaint: Make use of DynamicWidgetContainer

This patch adds the new DynamicWidgetContainer for the right panel
elements. This allows the user to collapse, expand or even detach
widgets to a separate window. The collapsed or expanded state is
persisted so that they are restored after application startup.
With this change it is possible to shrink the size of widgets to a
minimum in order to give more space to other currently important
widgets.
This commit is contained in:
Torstennator 2023-09-15 12:07:52 +02:00 committed by Andrew Kaster
parent b65e711929
commit c85c61571c
3 changed files with 64 additions and 40 deletions

View file

@ -12,6 +12,7 @@
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/DynamicWidgetContainer.h>
#include <LibGUI/Icon.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Statusbar.h>
@ -53,8 +54,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(main_widget->initialize_menubar(*window));
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
if (main_widget->request_close())
if (main_widget->request_close()) {
GUI::DynamicWidgetContainer::close_all_detached_windows();
return GUI::Window::CloseRequestDecision::Close;
}
return GUI::Window::CloseRequestDecision::StayOpen;
};