diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/guitest2.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/Userland/guitest2.cpp b/Userland/guitest2.cpp index ecc9b09166..0244d20e86 100644 --- a/Userland/guitest2.cpp +++ b/Userland/guitest2.cpp @@ -11,15 +11,20 @@ #include <LibGUI/GWindow.h> #include <LibGUI/GWidget.h> #include <LibGUI/GLabel.h> +#include <LibGUI/GButton.h> #include <LibGUI/GEventLoop.h> static GWindow* make_font_test_window(); +static GWindow* make_launcher_window(); int main(int argc, char** argv) { GEventLoop loop; - auto* window = make_font_test_window(); - window->show(); + auto* font_test_window = make_font_test_window(); + font_test_window->show(); + + auto* launcher_window = make_launcher_window(); + launcher_window->show(); return loop.exec(); } @@ -51,3 +56,31 @@ GWindow* make_font_test_window() return window; } + +GWindow* make_launcher_window() +{ + auto* window = new GWindow; + window->set_title("Launcher"); + window->set_rect({ 100, 400, 80, 200 }); + + auto* widget = new GWidget; + window->set_main_widget(widget); + widget->setWindowRelativeRect({ 0, 0, 80, 200 }); + + auto* label = new GLabel(widget); + label->setWindowRelativeRect({ 0, 0, 80, 20 }); + label->setText("Apps"); + + auto* button = new GButton(widget); + button->setWindowRelativeRect({ 5, 20, 70, 20 }); + button->set_caption("Terminal"); + + button->on_click = [] (GButton&) { + if (!fork()) { + execve("/bin/Terminal", nullptr, nullptr); + ASSERT_NOT_REACHED(); + } + }; + + return window; +} |