diff --git a/Userland/Applications/ThemeEditor/CMakeLists.txt b/Userland/Applications/ThemeEditor/CMakeLists.txt index 64a7f1614b..d65962e66e 100644 --- a/Userland/Applications/ThemeEditor/CMakeLists.txt +++ b/Userland/Applications/ThemeEditor/CMakeLists.txt @@ -3,9 +3,12 @@ serenity_component( TARGETS ThemeEditor ) +compile_gml(ThemeEditor.gml ThemeEditorGML.h theme_editor_gml) + set(SOURCES PreviewWidget.cpp main.cpp + ThemeEditorGML.h ) serenity_app(ThemeEditor ICON app-theme-editor) diff --git a/Userland/Applications/ThemeEditor/ThemeEditor.gml b/Userland/Applications/ThemeEditor/ThemeEditor.gml new file mode 100644 index 0000000000..31621f989b --- /dev/null +++ b/Userland/Applications/ThemeEditor/ThemeEditor.gml @@ -0,0 +1,23 @@ +@GUI::Widget { + layout: @GUI::VerticalBoxLayout + fill_with_background_color: true + + @GUI::Frame { + layout: @GUI::HorizontalBoxLayout + name: "preview_frame" + } + + @GUI::Widget { + layout: @GUI::HorizontalBoxLayout + fixed_height: 20 + + @GUI::ComboBox { + name: "color_combo_box" + model_only: true + } + + @GUI::ColorInput { + name: "color_input" + } + } +} diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index f9d944b737..2639f70a4f 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -6,6 +6,7 @@ */ #include "PreviewWidget.h" +#include #include #include #include @@ -98,20 +99,13 @@ int main(int argc, char** argv) #undef __ENUMERATE_COLOR_ROLE auto& main_widget = window->set_main_widget(); - main_widget.set_fill_with_background_color(true); - main_widget.set_layout(); + main_widget.load_from_gml(theme_editor_gml); - auto& preview_widget = main_widget.add(startup_preview_palette); - preview_widget.set_fixed_size(480, 360); + auto& preview_widget = main_widget.find_descendant_of_type_named("preview_frame") + ->add(startup_preview_palette); + auto& combo_box = *main_widget.find_descendant_of_type_named("color_combo_box"); + auto& color_input = *main_widget.find_descendant_of_type_named("color_input"); - auto& horizontal_container = main_widget.add(); - horizontal_container.set_layout(); - horizontal_container.set_fixed_size(480, 20); - - auto& combo_box = horizontal_container.add(); - auto& color_input = horizontal_container.add(); - - combo_box.set_only_allow_values_from_model(true); combo_box.set_model(adopt_ref(*new ColorRoleModel(color_roles))); combo_box.on_change = [&](auto&, auto& index) { auto role = index.model()->data(index, GUI::ModelRole::Custom).to_color_role();