summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Widget.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-16 16:52:56 +0000
committerSam Atkins <atkinssj@gmail.com>2023-02-18 16:56:56 +0000
commitab6ef53247ec363e61b28f4afc994edac39dc866 (patch)
tree659edff4c2645ea9075cb20243e1c99aed6b18db /Userland/Libraries/LibGUI/Widget.cpp
parent6ceb185865e242462c4f4ad310ec0c0a928c2f31 (diff)
downloadserenity-ab6ef53247ec363e61b28f4afc994edac39dc866.zip
LibGUI: Add Widget::add_spacer() wrapper
This just calls Layout::try_add_spacer(), but saves you having to access the Widget's Layout directly. We verify that the Widget has a Layout, since it would be a programming error if we tried to do so without one.
Diffstat (limited to 'Userland/Libraries/LibGUI/Widget.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Widget.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp
index 0b0f5c6e37..ce16af49ce 100644
--- a/Userland/Libraries/LibGUI/Widget.cpp
+++ b/Userland/Libraries/LibGUI/Widget.cpp
@@ -1266,4 +1266,10 @@ bool Widget::is_visible_for_timer_purposes() const
return is_visible() && Object::is_visible_for_timer_purposes();
}
+ErrorOr<void> Widget::add_spacer()
+{
+ VERIFY(layout());
+ return layout()->try_add_spacer();
+}
+
}