mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +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:
parent
27bd2eab22
commit
65a11fb5f9
11 changed files with 99 additions and 94 deletions
|
@ -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>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue