From 5b31a3dbc7358de2b1a3ae6272be7f3fce0d5445 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 16 Nov 2022 07:35:02 -0500 Subject: LibGUI: Allow more programmatic control over GUI::InputBox This will be needed for WebDriver, which will require constructing and controlling dialogs manually. Currently, InputBox will only set its text value when the OK button is pressed. This changes InputBox to update its text when done(ExecResult::OK) is invoked in any way. This also makes the text_value() method public, allows for setting the text value, and allows for moving-in the initial text value. --- Userland/Libraries/LibGUI/InputBox.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Userland/Libraries/LibGUI/InputBox.h') diff --git a/Userland/Libraries/LibGUI/InputBox.h b/Userland/Libraries/LibGUI/InputBox.h index f34c542035..2c15bda02f 100644 --- a/Userland/Libraries/LibGUI/InputBox.h +++ b/Userland/Libraries/LibGUI/InputBox.h @@ -24,12 +24,15 @@ public: static ExecResult show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text); -private: - explicit InputBox(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type); + String const& text_value() const { return m_text_value; } + void set_text_value(String text_value); - String text_value() const { return m_text_value; } +private: + explicit InputBox(Window* parent_window, String text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type); + virtual void on_done(ExecResult) override; void build(InputType input_type); + String m_text_value; String m_prompt; String m_placeholder; -- cgit v1.2.3