summaryrefslogtreecommitdiff
path: root/Applications/TextEditor/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Applications/TextEditor/main.cpp')
-rw-r--r--Applications/TextEditor/main.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp
index 73e9ebb9fd..23d67ae586 100644
--- a/Applications/TextEditor/main.cpp
+++ b/Applications/TextEditor/main.cpp
@@ -46,19 +46,18 @@ int main(int argc, char** argv)
window->set_title("Text Editor");
window->set_rect(20, 200, 640, 400);
- auto text_widget = TextEditorWidget::construct();
- window->set_main_widget(text_widget);
+ auto& text_widget = window->set_main_widget<TextEditorWidget>();
- text_widget->editor().set_focus(true);
+ text_widget.editor().set_focus(true);
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
- if (text_widget->request_close())
+ if (text_widget.request_close())
return GUI::Window::CloseRequestDecision::Close;
return GUI::Window::CloseRequestDecision::StayOpen;
};
if (argc >= 2)
- text_widget->open_sesame(argv[1]);
+ text_widget.open_sesame(argv[1]);
window->show();
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/TextEditor16.png"));