summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/InputBox.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-16 07:35:02 -0500
committerLinus Groh <mail@linusgroh.de>2022-11-16 17:23:56 +0000
commit5b31a3dbc7358de2b1a3ae6272be7f3fce0d5445 (patch)
tree0bfd6016831f15e5a38c9beaad384e13e8f1fe50 /Userland/Libraries/LibGUI/InputBox.h
parentdb4fa36b583dc06df67538c409bf489617b99ae7 (diff)
downloadserenity-5b31a3dbc7358de2b1a3ae6272be7f3fce0d5445.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/InputBox.h')
-rw-r--r--Userland/Libraries/LibGUI/InputBox.h9
1 files changed, 6 insertions, 3 deletions
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;