diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-03 21:42:48 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-03 22:37:48 +0100 |
commit | 03e0ddce5237b6ad7b84724ef03039e413944f00 (patch) | |
tree | ee45767b85f54584ce6c3f08dd34b7f8e84ef1cd /Applications/Calculator | |
parent | 0cafbbf09c303a51a48b67ef951fa828979cde6e (diff) | |
download | serenity-03e0ddce5237b6ad7b84724ef03039e413944f00.zip |
LibGUI: Some more convenience functions for constructing widgets
This patch adds two new API's:
- WidgetType& GUI::Window::set_main_widget<WidgetType>();
This creates a new main widget for a window, assigns it, and returns
it to you as a WidgetType&.
- LayoutType& GUI::Widget::set_layout<LayoutType>();
Same basic idea, creates a new layout, assigns it, and returns it to
you as a LayoutType&.
Diffstat (limited to 'Applications/Calculator')
-rw-r--r-- | Applications/Calculator/main.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Applications/Calculator/main.cpp b/Applications/Calculator/main.cpp index 6b166c5e25..772564f4a4 100644 --- a/Applications/Calculator/main.cpp +++ b/Applications/Calculator/main.cpp @@ -60,8 +60,7 @@ int main(int argc, char** argv) window->set_resizable(false); window->set_rect({ 300, 200, 254, 213 }); - auto calc_widget = CalculatorWidget::construct(); - window->set_main_widget(calc_widget); + window->set_main_widget<CalculatorWidget>(); window->show(); window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-calculator.png")); |