mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 08:52:54 +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
Notes:
sideshowbarker
2024-07-18 11:58:25 +09:00
Author: https://github.com/metmo
Commit: f2aa5efbeb
Pull-request: https://github.com/SerenityOS/serenity/pull/8151
Issue: https://github.com/SerenityOS/serenity/issues/7989
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