mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibGUI: Add GUI::TabWidget::add_tab() that takes a constructed tab
This patch adds a new add_tab() function in GUI::TabWidget that takes an already created NonnullRefPtr<Widget> object. This allows us to handle errors while creating the Tab object and then pass it to this function to actually add the object to the TabWidget.
This commit is contained in:
parent
c355e9692d
commit
61789de11d
1 changed files with 7 additions and 0 deletions
|
@ -73,6 +73,13 @@ public:
|
|||
return *t;
|
||||
}
|
||||
|
||||
ErrorOr<void> add_tab(NonnullRefPtr<Widget> const& tab, DeprecatedString title)
|
||||
{
|
||||
tab->set_title(move(title));
|
||||
TRY(try_add_widget(*tab));
|
||||
return {};
|
||||
}
|
||||
|
||||
void remove_tab(Widget& tab) { remove_widget(tab); }
|
||||
void remove_all_tabs_except(Widget& tab);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue