mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 19:05:06 +00:00

It's a little unfortunate that we have two separate code paths that can lead to asking the user about this. Longer-term we should find a way to unify these things. Fixes #491.
28 lines
741 B
C++
28 lines
741 B
C++
#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();
|
|
}
|