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

LibGUI: Implement destroying individual windows without exiting the process.

This commit is contained in:
Andreas Kling 2019-01-30 20:03:52 +01:00
parent 5c25f0c4db
commit 37ab7b7a8c
8 changed files with 85 additions and 30 deletions

View file

@ -63,11 +63,11 @@ GWindow* make_launcher_window()
{
auto* window = new GWindow;
window->set_title("Launcher");
window->set_rect({ 100, 400, 100, 200 });
window->set_rect({ 100, 400, 100, 230 });
auto* widget = new GWidget;
window->set_main_widget(widget);
widget->set_relative_rect({ 0, 0, 100, 200 });
widget->set_relative_rect({ 0, 0, 100, 230 });
auto* label = new GLabel(widget);
label->set_relative_rect({ 0, 0, 100, 20 });
@ -124,5 +124,12 @@ GWindow* make_launcher_window()
window->set_focused_widget(textbox);
auto* close_button = new GButton(widget);
close_button->set_relative_rect({ 5, 200, 90, 20 });
close_button->set_caption("Close");
close_button->on_click = [window] (GButton&) {
window->close();
};
return window;
}