Playground: Pre-populate the text editor with some GML

The text editor is now populated with some very basic GML after startup:

    @GUI::Widget {
        layout: @GUI::VerticalBoxLayout {
        }

        // Now add some widgets!
    }

Less typing, less intimidating! :^)
This commit is contained in:
Linus Groh 2020-12-27 17:21:31 +01:00 committed by Andreas Kling
parent 999e3f87a9
commit dc55fbeb79
Notes: sideshowbarker 2024-07-19 00:33:36 +09:00

View file

@ -44,6 +44,14 @@ int main(int argc, char** argv)
editor.set_syntax_highlighter(make<GUI::GMLSyntaxHighlighter>());
editor.set_automatic_indentation_enabled(true);
editor.set_text(R"~~~(@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
}
// Now add some widgets!
}
)~~~");
editor.set_cursor(4, 28); // after "...widgets!"
editor.on_change = [&] {
preview.remove_all_children();