diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-27 09:34:28 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-27 09:34:28 +0200 |
commit | 7dc7f11ed8355833b2432b65c1c4ef05ee1782f8 (patch) | |
tree | 8b9965fc74ac1753d20885c687f1a57b89bc7d57 /Libraries/LibGUI/GWidget.cpp | |
parent | 10c35d345ad07a50a5f0f48639bb84409b1f3b02 (diff) | |
download | serenity-7dc7f11ed8355833b2432b65c1c4ef05ee1782f8.zip |
GWidget: Add set_size_policy(Orientation, Policy).
This allows you to set the policy for a single orientation rather than
both at the same time.
Diffstat (limited to 'Libraries/LibGUI/GWidget.cpp')
-rw-r--r-- | Libraries/LibGUI/GWidget.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibGUI/GWidget.cpp b/Libraries/LibGUI/GWidget.cpp index eb963b0314..16961b30b2 100644 --- a/Libraries/LibGUI/GWidget.cpp +++ b/Libraries/LibGUI/GWidget.cpp @@ -404,6 +404,14 @@ void GWidget::set_preferred_size(const Size& size) invalidate_layout(); } +void GWidget::set_size_policy(Orientation orientation, SizePolicy policy) +{ + if (orientation == Orientation::Horizontal) + set_size_policy(policy, m_vertical_size_policy); + else + set_size_policy(m_horizontal_size_policy, policy); +} + void GWidget::set_size_policy(SizePolicy horizontal_policy, SizePolicy vertical_policy) { if (m_horizontal_size_policy == horizontal_policy && m_vertical_size_policy == vertical_policy) |