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