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

LibGUI: Allow InputBox to show placeholder

If passed as an argument, showing an InputBox now supports to
set a placeholder text which will be shown in its TextBox.
This commit is contained in:
networkException 2021-07-06 16:47:44 +02:00 committed by Andreas Kling
parent f8798c154b
commit 72776b2f61
2 changed files with 12 additions and 5 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Jakob-Niklas See <git@nwex.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -15,16 +16,17 @@ class InputBox : public Dialog {
public:
virtual ~InputBox() override;
static int show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
static int show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title, const StringView& placeholder = {});
private:
explicit InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
explicit InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title, const StringView& placeholder);
String text_value() const { return m_text_value; }
void build();
String m_text_value;
String m_prompt;
String m_placeholder;
RefPtr<Button> m_ok_button;
RefPtr<Button> m_cancel_button;