From a4b2d6cf1e8d1bcd8af39a8f8530045d08629b48 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Fri, 17 Jul 2020 10:21:44 -0400 Subject: [PATCH] LibGUI: Set parent icon, margins and disable resize for InputBox Gives a more compact, uniform appearance to input boxes. --- Libraries/LibGUI/InputBox.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Libraries/LibGUI/InputBox.cpp b/Libraries/LibGUI/InputBox.cpp index 388437751e..61519a6a73 100644 --- a/Libraries/LibGUI/InputBox.cpp +++ b/Libraries/LibGUI/InputBox.cpp @@ -49,6 +49,9 @@ InputBox::~InputBox() int InputBox::show(String& text_value, Window* parent_window, const StringView& prompt, const StringView& title) { auto box = InputBox::construct(parent_window, prompt, title); + box->set_resizable(false); + if (parent_window) + box->set_icon(parent_window->icon()); auto result = box->exec(); text_value = box->text_value(); return result; @@ -62,19 +65,23 @@ void InputBox::build() int title_width = widget.font().width(title()) + 24 /* icon, plus a little padding -- not perfect */; int max_width = AK::max(text_width, title_width); - set_rect(x(), y(), max_width + 80, 80); + set_rect(x(), y(), max_width + 140, 62); widget.set_layout(); widget.set_fill_with_background_color(true); - widget.layout()->set_margins({ 8, 8, 8, 8 }); - widget.layout()->set_spacing(8); + widget.layout()->set_margins({ 6, 6, 6, 6 }); + widget.layout()->set_spacing(6); - auto& label = widget.add