mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
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&.
This commit is contained in:
parent
0cafbbf09c
commit
03e0ddce52
10 changed files with 66 additions and 60 deletions
|
@ -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"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue