mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:54:58 +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:
parent
b65e711929
commit
c85c61571c
3 changed files with 64 additions and 40 deletions
|
@ -43,59 +43,80 @@
|
|||
}
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fill_with_background_color: true
|
||||
@GUI::DynamicWidgetContainer {
|
||||
section_label: "Editor Panels"
|
||||
config_domain: "PixelPaint"
|
||||
with_individual_order: true
|
||||
fixed_width: 200
|
||||
layout: @GUI::VerticalBoxLayout {}
|
||||
preferred_height: "grow"
|
||||
detached_size: [200, 640]
|
||||
|
||||
@GUI::GroupBox {
|
||||
title: "Layers"
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [6]
|
||||
@GUI::DynamicWidgetContainer {
|
||||
section_label: "Layers"
|
||||
config_domain: "PixelPaint"
|
||||
preferred_height: "grow"
|
||||
detached_size: [250, 600]
|
||||
|
||||
@GUI::GroupBox {
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [6]
|
||||
}
|
||||
|
||||
@PixelPaint::LayerListWidget {
|
||||
name: "layer_list_widget"
|
||||
}
|
||||
}
|
||||
|
||||
@PixelPaint::LayerListWidget {
|
||||
name: "layer_list_widget"
|
||||
@PixelPaint::LayerPropertiesWidget {
|
||||
name: "layer_properties_widget"
|
||||
max_height: 94
|
||||
}
|
||||
}
|
||||
|
||||
@PixelPaint::LayerPropertiesWidget {
|
||||
name: "layer_properties_widget"
|
||||
max_height: 94
|
||||
}
|
||||
@GUI::DynamicWidgetContainer {
|
||||
section_label: "Color Visualizations"
|
||||
config_domain: "PixelPaint"
|
||||
|
||||
@GUI::GroupBox {
|
||||
title: "Histogram"
|
||||
preferred_height: "shrink"
|
||||
visible: false
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [6]
|
||||
}
|
||||
@GUI::Widget {
|
||||
layout: @GUI::VerticalBoxLayout {}
|
||||
|
||||
@PixelPaint::HistogramWidget {
|
||||
name: "histogram_widget"
|
||||
min_height: 65
|
||||
@GUI::GroupBox {
|
||||
visible: false
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [6]
|
||||
}
|
||||
|
||||
@PixelPaint::HistogramWidget {
|
||||
name: "histogram_widget"
|
||||
min_height: 65
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::GroupBox {
|
||||
min_height: 80
|
||||
visible: false
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [6]
|
||||
}
|
||||
|
||||
@PixelPaint::VectorscopeWidget {
|
||||
name: "vectorscope_widget"
|
||||
preferred_height: "fit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::GroupBox {
|
||||
title: "Vectorscope"
|
||||
min_height: 80
|
||||
visible: false
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [6]
|
||||
}
|
||||
@GUI::DynamicWidgetContainer {
|
||||
section_label: "Tool Properties"
|
||||
config_domain: "PixelPaint"
|
||||
detached_size: [200, 200]
|
||||
|
||||
@PixelPaint::VectorscopeWidget {
|
||||
name: "vectorscope_widget"
|
||||
preferred_height: "fit"
|
||||
@PixelPaint::ToolPropertiesWidget {
|
||||
name: "tool_properties_widget"
|
||||
max_height: 144
|
||||
}
|
||||
}
|
||||
|
||||
@PixelPaint::ToolPropertiesWidget {
|
||||
name: "tool_properties_widget"
|
||||
max_height: 144
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ ToolPropertiesWidget::ToolPropertiesWidget()
|
|||
{
|
||||
set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
m_group_box = add<GUI::GroupBox>("Tool properties"sv);
|
||||
m_group_box = add<GUI::GroupBox>();
|
||||
m_group_box->set_layout<GUI::VerticalBoxLayout>(8);
|
||||
m_tool_widget_stack = m_group_box->add<GUI::StackWidget>();
|
||||
m_error_label = m_tool_widget_stack->add<GUI::Label>();
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue