mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 14:25:06 +00:00
PixelPaint: Add basic support for closing tabs
This enables closing of tabs in PixelPaint, for the moment very basic with no checking if the image is modified or saved.
This commit is contained in:
parent
32fc8da917
commit
f2aa5efbeb
1 changed files with 8 additions and 0 deletions
|
@ -61,6 +61,7 @@ int main(int argc, char** argv)
|
|||
auto& toolbox = *main_widget.find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox");
|
||||
auto& tab_widget = *main_widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||
tab_widget.set_container_margins({ 4, 4, 5, 5 });
|
||||
tab_widget.set_close_button_enabled(true);
|
||||
|
||||
auto& palette_widget = *main_widget.find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget");
|
||||
|
||||
|
@ -524,6 +525,13 @@ int main(int argc, char** argv)
|
|||
return image_editor;
|
||||
};
|
||||
|
||||
tab_widget.on_tab_close_click = [&](auto& widget) {
|
||||
auto& image_editor = downcast<PixelPaint::ImageEditor>(widget);
|
||||
tab_widget.deferred_invoke([&](auto&) {
|
||||
tab_widget.remove_tab(image_editor);
|
||||
});
|
||||
};
|
||||
|
||||
tab_widget.on_change = [&](auto& widget) {
|
||||
auto& image_editor = downcast<PixelPaint::ImageEditor>(widget);
|
||||
palette_widget.set_image_editor(image_editor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue