summaryrefslogtreecommitdiff
path: root/Applications/TextEditor/main.cpp
blob: 80f7925da2d4545fd78afd159dee2db0a107a4dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "TextEditorWidget.h"
#include <LibDraw/PNGLoader.h>

int main(int argc, char** argv)
{
    GApplication app(argc, argv);

    auto* window = new GWindow;
    window->set_title("Text Editor");
    window->set_rect(20, 200, 640, 400);

    auto* text_widget = new TextEditorWidget();
    window->set_main_widget(text_widget);

    window->on_close_request = [&]() -> GWindow::CloseRequestDecision {
        if (text_widget->request_close())
            return GWindow::CloseRequestDecision::Close;
        return GWindow::CloseRequestDecision::StayOpen;
    };

    if (argc >= 2)
        text_widget->open_sesame(argv[1]);

    window->show();
    window->set_icon(load_png("/res/icons/TextEditor16.png"));

    return app.exec();
}