mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
LibGUI: Add InputBox::show with required parent window argument
Similar to MessageBox::show, this encourages passing in a window.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace GUI {
|
||||
|
||||
InputBox::InputBox(const StringView& prompt, const StringView& title, GUI::Window* parent_window)
|
||||
InputBox::InputBox(Window* parent_window, const StringView& prompt, const StringView& title)
|
||||
: Dialog(parent_window)
|
||||
, m_prompt(prompt)
|
||||
{
|
||||
@@ -46,6 +46,14 @@ 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);
|
||||
auto result = box->exec();
|
||||
text_value = box->text_value();
|
||||
return result;
|
||||
}
|
||||
|
||||
void InputBox::build()
|
||||
{
|
||||
auto& widget = set_main_widget<Widget>();
|
||||
|
||||
Reference in New Issue
Block a user