summaryrefslogtreecommitdiff
path: root/Applications/HexEditor/main.cpp
blob: f540dcc5fdf154c48ab582873dad24e48ebabce4 (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 "HexEditorWidget.h"
#include <LibDraw/PNGLoader.h>

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

    auto window = GWindow::construct();
    window->set_title("Hex Editor");
    window->set_rect(20, 200, 640, 400);

    auto hex_editor_widget = HexEditorWidget::construct();
    window->set_main_widget(hex_editor_widget);

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

    window->show();
    window->set_icon(load_png("/res/icons/16x16/app-hexeditor.png"));

    if (argc >= 2)
        hex_editor_widget->open_file(argv[1]);

    return app.exec();
}