summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-01-12 17:01:28 +0000
committerAndreas Kling <kling@serenityos.org>2023-01-13 13:37:19 +0100
commitd443a51b50e14c3d53d6fc26ad8fa246555b676b (patch)
treecc4ae79b918062f544b7e783bae813fb10d1a68e /Userland
parent0bc591a69ba46c9473f58d577d9d7c2118f1800a (diff)
downloadserenity-d443a51b50e14c3d53d6fc26ad8fa246555b676b.zip
GMLPlayground: Move layout to GML
There isn't much layout right now, but it felt very wrong to not have the GML editor use GML. :^)
Diffstat (limited to 'Userland')
-rw-r--r--Userland/DevTools/GMLPlayground/CMakeLists.txt6
-rw-r--r--Userland/DevTools/GMLPlayground/GMLPlaygroundWindow.gml17
-rw-r--r--Userland/DevTools/GMLPlayground/main.cpp11
3 files changed, 31 insertions, 3 deletions
diff --git a/Userland/DevTools/GMLPlayground/CMakeLists.txt b/Userland/DevTools/GMLPlayground/CMakeLists.txt
index ed493dfa7d..8b91442fc7 100644
--- a/Userland/DevTools/GMLPlayground/CMakeLists.txt
+++ b/Userland/DevTools/GMLPlayground/CMakeLists.txt
@@ -4,9 +4,15 @@ serenity_component(
TARGETS GMLPlayground
)
+compile_gml(GMLPlaygroundWindow.gml GMLPlaygroundWindowGML.h gml_playground_window_gml)
+
set(SOURCES
main.cpp
)
+set(GENERATED_SOURCES
+ GMLPlaygroundWindowGML.h
+)
+
serenity_app(GMLPlayground ICON app-gml-playground)
target_link_libraries(GMLPlayground PRIVATE LibCore LibDesktop LibFileSystemAccessClient LibGfx LibGUI LibMain LibSyntax)
diff --git a/Userland/DevTools/GMLPlayground/GMLPlaygroundWindow.gml b/Userland/DevTools/GMLPlayground/GMLPlaygroundWindow.gml
new file mode 100644
index 0000000000..3f5c279ca8
--- /dev/null
+++ b/Userland/DevTools/GMLPlayground/GMLPlaygroundWindow.gml
@@ -0,0 +1,17 @@
+@GUI::Widget {
+ layout: @GUI::VerticalBoxLayout {}
+ fill_with_background_color: true
+
+ @GUI::HorizontalSplitter {
+ layout: @GUI::HorizontalBoxLayout {}
+ name: "splitter"
+
+ @GUI::TextEditor {
+ name: "text_editor"
+ }
+
+ @GUI::Frame {
+ name: "preview_frame"
+ }
+ }
+}
diff --git a/Userland/DevTools/GMLPlayground/main.cpp b/Userland/DevTools/GMLPlayground/main.cpp
index f4266602b4..33390a55a4 100644
--- a/Userland/DevTools/GMLPlayground/main.cpp
+++ b/Userland/DevTools/GMLPlayground/main.cpp
@@ -2,6 +2,7 @@
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Julius Heijmen <julius.heijmen@gmail.com>
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
+ * Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -27,6 +28,7 @@
#include <LibGUI/VimEditingEngine.h>
#include <LibGUI/Window.h>
#include <LibMain/Main.h>
+#include <Userland/DevTools/GMLPlayground/GMLPlaygroundWindowGML.h>
namespace {
@@ -84,9 +86,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
window->resize(800, 600);
- auto splitter = TRY(window->set_main_widget<GUI::HorizontalSplitter>());
- auto editor = TRY(splitter->try_add<GUI::TextEditor>());
- auto preview_frame_widget = TRY(splitter->try_add<GUI::Frame>());
+ auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
+ TRY(main_widget->load_from_gml(gml_playground_window_gml));
+
+ auto splitter = main_widget->find_descendant_of_type_named<GUI::HorizontalSplitter>("splitter");
+ auto editor = main_widget->find_descendant_of_type_named<GUI::TextEditor>("text_editor");
+ auto preview_frame_widget = main_widget->find_descendant_of_type_named<GUI::Frame>("preview_frame");
auto preview_window = TRY(GUI::Window::try_create());
preview_window->set_title("Preview - GML Playground");