mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 20:32:56 +03: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
Notes:
sideshowbarker
2024-07-17 08:36:27 +09:00
Author: https://github.com/Baitinq Commit: https://github.com/SerenityOS/serenity/commit/61789de11d Pull-request: https://github.com/SerenityOS/serenity/pull/16523
@ -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…
Reference in New Issue
Block a user