|
@@ -49,6 +49,9 @@ InputBox::~InputBox()
|
|
int InputBox::show(String& text_value, Window* parent_window, const StringView& prompt, const StringView& title)
|
|
int InputBox::show(String& text_value, Window* parent_window, const StringView& prompt, const StringView& title)
|
|
{
|
|
{
|
|
auto box = InputBox::construct(parent_window, prompt, 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();
|
|
auto result = box->exec();
|
|
text_value = box->text_value();
|
|
text_value = box->text_value();
|
|
return result;
|
|
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 title_width = widget.font().width(title()) + 24 /* icon, plus a little padding -- not perfect */;
|
|
int max_width = AK::max(text_width, title_width);
|
|
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<VerticalBoxLayout>();
|
|
widget.set_layout<VerticalBoxLayout>();
|
|
widget.set_fill_with_background_color(true);
|
|
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<Label>(m_prompt);
|
|
|
|
|
|
+ auto& label_editor_container = widget.add<Widget>();
|
|
|
|
+ label_editor_container.set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
|
|
|
|
+ label_editor_container.set_layout<HorizontalBoxLayout>();
|
|
|
|
+
|
|
|
|
+ auto& label = label_editor_container.add<Label>(m_prompt);
|
|
label.set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
|
label.set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
|
label.set_preferred_size(text_width, 16);
|
|
label.set_preferred_size(text_width, 16);
|
|
|
|
|
|
- m_text_editor = widget.add<TextBox>();
|
|
|
|
|
|
+ m_text_editor = label_editor_container.add<TextBox>();
|
|
m_text_editor->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
|
m_text_editor->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
|
m_text_editor->set_preferred_size(0, 19);
|
|
m_text_editor->set_preferred_size(0, 19);
|
|
|
|
|
|
@@ -85,7 +92,9 @@ void InputBox::build()
|
|
|
|
|
|
auto& button_container_inner = button_container_outer.add<Widget>();
|
|
auto& button_container_inner = button_container_outer.add<Widget>();
|
|
button_container_inner.set_layout<HorizontalBoxLayout>();
|
|
button_container_inner.set_layout<HorizontalBoxLayout>();
|
|
- button_container_inner.layout()->set_spacing(8);
|
|
|
|
|
|
+ button_container_inner.layout()->set_spacing(6);
|
|
|
|
+ button_container_inner.layout()->set_margins({ 4, 4, 0, 4 });
|
|
|
|
+ button_container_inner.layout()->add_spacer();
|
|
|
|
|
|
m_ok_button = button_container_inner.add<Button>();
|
|
m_ok_button = button_container_inner.add<Button>();
|
|
m_ok_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
|
m_ok_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|