1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibGUI: Use default Button and TextBox heights in InputBox

This commit is contained in:
Andreas Kling 2021-11-05 01:03:37 +01:00
parent 7a1a8d267d
commit c098a6495b

View file

@ -47,7 +47,7 @@ void InputBox::build(InputType input_type)
int title_width = widget.font().width(title()) + 24 /* icon, plus a little padding -- not perfect */;
int max_width = max(text_width, title_width);
set_rect(x(), y(), max_width + 140, 62);
set_rect(x(), y(), max_width + 140, 66);
widget.set_layout<VerticalBoxLayout>();
widget.set_fill_with_background_color(true);
@ -70,14 +70,13 @@ void InputBox::build(InputType input_type)
break;
}
m_text_editor->set_fixed_height(19);
m_text_editor->set_text(m_text_value);
if (!m_placeholder.is_null())
m_text_editor->set_placeholder(m_placeholder);
auto& button_container_outer = widget.add<Widget>();
button_container_outer.set_fixed_height(20);
button_container_outer.set_fixed_height(22);
button_container_outer.set_layout<VerticalBoxLayout>();
auto& button_container_inner = button_container_outer.add<Widget>();
@ -87,7 +86,6 @@ void InputBox::build(InputType input_type)
button_container_inner.layout()->add_spacer();
m_ok_button = button_container_inner.add<Button>();
m_ok_button->set_fixed_height(20);
m_ok_button->set_text("OK");
m_ok_button->on_click = [this](auto) {
dbgln("GUI::InputBox: OK button clicked");
@ -96,7 +94,6 @@ void InputBox::build(InputType input_type)
};
m_cancel_button = button_container_inner.add<Button>();
m_cancel_button->set_fixed_height(20);
m_cancel_button->set_text("Cancel");
m_cancel_button->on_click = [this](auto) {
dbgln("GUI::InputBox: Cancel button clicked");