mirror of
https://github.com/RGBCube/serenity
synced 2025-05-17 18:35:07 +00:00
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
This commit is contained in:
parent
4697195645
commit
0f3e57a6fb
37 changed files with 203 additions and 246 deletions
|
@ -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"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue