From ea0ab87b88c8778205d11c98be67c384b34986f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Thu, 9 Feb 2023 18:05:54 +0100 Subject: [PATCH] LibGUI: Allow creating margins from arrays This is necessary for upcoming GML -> C++ compilation. --- Userland/Libraries/LibGUI/Margins.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Userland/Libraries/LibGUI/Margins.h b/Userland/Libraries/LibGUI/Margins.h index a6bf8d9aa3..3083d558fe 100644 --- a/Userland/Libraries/LibGUI/Margins.h +++ b/Userland/Libraries/LibGUI/Margins.h @@ -42,6 +42,29 @@ public: , m_left(left) { } + + // GML compatibility constructors only for use in auto-generated code. + + explicit Margins(Array all) + : Margins(all[0]) + { + } + + explicit Margins(Array vertical_horizontal) + : Margins(vertical_horizontal[0], vertical_horizontal[1]) + { + } + + explicit Margins(Array top_horizontal_bottom) + : Margins(top_horizontal_bottom[0], top_horizontal_bottom[1], top_horizontal_bottom[2]) + { + } + + explicit Margins(Array margins) + : Margins(margins[0], margins[1], margins[2], margins[3]) + { + } + ~Margins() = default; [[nodiscard]] Gfx::IntRect applied_to(Gfx::IntRect const& input) const