2019-07-11 13:52:33 -05:00
|
|
|
#include "TextEditorWidget.h"
|
2019-07-28 10:18:49 +02:00
|
|
|
#include <LibDraw/PNGLoader.h>
|
2019-05-16 02:47:28 +02:00
|
|
|
|
2019-03-07 00:31:06 +01:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
|
{
|
|
|
|
|
GApplication app(argc, argv);
|
|
|
|
|
|
2019-09-21 18:34:06 +02:00
|
|
|
auto window = GWindow::construct();
|
2019-05-27 23:33:17 +02:00
|
|
|
window->set_title("Text Editor");
|
2019-03-07 00:31:06 +01:00
|
|
|
window->set_rect(20, 200, 640, 400);
|
2019-04-13 16:59:55 +02:00
|
|
|
|
2019-09-21 20:04:00 +02:00
|
|
|
auto text_widget = TextEditorWidget::construct();
|
2019-07-11 13:52:33 -05:00
|
|
|
window->set_main_widget(text_widget);
|
|
|
|
|
|
2019-11-30 15:34:08 +01:00
|
|
|
text_widget->editor().set_focus(true);
|
|
|
|
|
|
2019-08-27 20:37:41 +02:00
|
|
|
window->on_close_request = [&]() -> GWindow::CloseRequestDecision {
|
|
|
|
|
if (text_widget->request_close())
|
|
|
|
|
return GWindow::CloseRequestDecision::Close;
|
|
|
|
|
return GWindow::CloseRequestDecision::StayOpen;
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-11 13:52:33 -05:00
|
|
|
if (argc >= 2)
|
|
|
|
|
text_widget->open_sesame(argv[1]);
|
|
|
|
|
|
2019-07-15 15:58:37 -05:00
|
|
|
window->show();
|
2019-07-28 10:18:49 +02:00
|
|
|
window->set_icon(load_png("/res/icons/TextEditor16.png"));
|
2019-07-15 15:58:37 -05:00
|
|
|
|
2019-03-07 00:31:06 +01:00
|
|
|
return app.exec();
|
2019-07-23 18:20:00 +02:00
|
|
|
}
|