summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/TabWidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibGUI/TabWidget.h')
-rw-r--r--Userland/Libraries/LibGUI/TabWidget.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TabWidget.h b/Userland/Libraries/LibGUI/TabWidget.h
index bd232857e1..ac0d5402d0 100644
--- a/Userland/Libraries/LibGUI/TabWidget.h
+++ b/Userland/Libraries/LibGUI/TabWidget.h
@@ -36,10 +36,20 @@ public:
GUI::Margins const& container_margins() const { return m_container_margins; }
void set_container_margins(GUI::Margins const&);
+ ErrorOr<void> try_add_widget(StringView, Widget&);
+
void add_widget(StringView, Widget&);
void remove_widget(Widget&);
template<class T, class... Args>
+ ErrorOr<NonnullRefPtr<T>> try_add_tab(StringView title, Args&&... args)
+ {
+ auto t = TRY(T::try_create(forward<Args>(args)...));
+ TRY(try_add_widget(title, *t));
+ return *t;
+ }
+
+ template<class T, class... Args>
T& add_tab(StringView title, Args&&... args)
{
auto t = T::construct(forward<Args>(args)...);