summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/ThemeEditor/CMakeLists.txt2
-rw-r--r--Userland/Applications/ThemeEditor/PreviewWidget.cpp34
-rw-r--r--Userland/Applications/ThemeEditor/Previews/WindowPreview.gml29
3 files changed, 33 insertions, 32 deletions
diff --git a/Userland/Applications/ThemeEditor/CMakeLists.txt b/Userland/Applications/ThemeEditor/CMakeLists.txt
index f98563a658..ff9a28496d 100644
--- a/Userland/Applications/ThemeEditor/CMakeLists.txt
+++ b/Userland/Applications/ThemeEditor/CMakeLists.txt
@@ -9,6 +9,7 @@ compile_gml(ColorProperty.gml ColorPropertyGML.h color_property_gml)
compile_gml(FlagProperty.gml FlagPropertyGML.h flag_property_gml)
compile_gml(MetricProperty.gml MetricPropertyGML.h metric_property_gml)
compile_gml(PathProperty.gml PathPropertyGML.h path_property_gml)
+compile_gml(Previews/WindowPreview.gml WindowPreviewGML.h window_preview_gml)
set(SOURCES
main.cpp
@@ -20,6 +21,7 @@ set(SOURCES
MetricPropertyGML.h
PathPropertyGML.h
ThemeEditorGML.h
+ WindowPreviewGML.h
)
serenity_app(ThemeEditor ICON app-theme-editor)
diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.cpp b/Userland/Applications/ThemeEditor/PreviewWidget.cpp
index 900567080b..4847e8e847 100644
--- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp
+++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp
@@ -10,19 +10,13 @@
#include "PreviewWidget.h"
#include <AK/LexicalPath.h>
#include <AK/StringView.h>
+#include <Applications/ThemeEditor/WindowPreviewGML.h>
#include <LibCore/MimeData.h>
#include <LibFileSystemAccessClient/Client.h>
-#include <LibGUI/BoxLayout.h>
-#include <LibGUI/Button.h>
-#include <LibGUI/CheckBox.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Painter.h>
-#include <LibGUI/RadioButton.h>
-#include <LibGUI/Statusbar.h>
-#include <LibGUI/TextEditor.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/WindowTheme.h>
-#include <WindowServer/Compositor.h>
namespace ThemeEditor {
@@ -46,37 +40,13 @@ public:
private:
MiniWidgetGallery()
{
- m_button = add<GUI::Button>();
- m_button->set_text("Button");
- m_checkbox = add<GUI::CheckBox>();
- m_checkbox->set_text("Check box");
- m_radio = add<GUI::RadioButton>();
- m_radio->set_text("Radio button");
- m_statusbar = add<GUI::Statusbar>();
- m_statusbar->set_text("Status bar");
- m_editor = add<GUI::TextEditor>();
- m_editor->set_text("Text editor\nwith multiple\nlines.");
+ load_from_gml(window_preview_gml);
for_each_child_widget([](auto& child) {
child.set_focus_policy(GUI::FocusPolicy::NoFocus);
return IterationDecision::Continue;
});
}
-
- virtual void resize_event(GUI::ResizeEvent&) override
- {
- m_editor->set_relative_rect(10, 70, 200, 125);
- m_button->set_relative_rect(10, 10, 200, 20);
- m_checkbox->set_relative_rect(10, 30, 200, 20);
- m_radio->set_relative_rect(10, 50, 200, 20);
- m_statusbar->set_relative_rect(0, height() - 16, width(), 16);
- }
-
- RefPtr<GUI::TextEditor> m_editor;
- RefPtr<GUI::Button> m_button;
- RefPtr<GUI::CheckBox> m_checkbox;
- RefPtr<GUI::RadioButton> m_radio;
- RefPtr<GUI::Statusbar> m_statusbar;
};
PreviewWidget::PreviewWidget(Gfx::Palette const& initial_preview_palette)
diff --git a/Userland/Applications/ThemeEditor/Previews/WindowPreview.gml b/Userland/Applications/ThemeEditor/Previews/WindowPreview.gml
new file mode 100644
index 0000000000..3f9a782f28
--- /dev/null
+++ b/Userland/Applications/ThemeEditor/Previews/WindowPreview.gml
@@ -0,0 +1,29 @@
+@GUI::Frame {
+ layout: @GUI::VerticalBoxLayout {}
+
+ @GUI::Widget {
+ layout: @GUI::VerticalBoxLayout {
+ margins: [8, 100, 8, 8]
+ }
+
+ @GUI::Button {
+ text: "Button"
+ }
+
+ @GUI::CheckBox {
+ text: "Check box"
+ }
+
+ @GUI::RadioButton {
+ text: "Radio button"
+ }
+
+ @GUI::TextEditor {
+ text: "Text editor\nwith multiple\nlines."
+ }
+ }
+
+ @GUI::Statusbar {
+ text: "Status bar"
+ }
+}