summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/InputBox.h
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2023-04-16 16:02:29 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-18 10:05:21 +0200
commit7c314f38554ab95e0380cced9cf352b606391f96 (patch)
treed4d9a957557420dc6a373dfa2dfe843e61449b0f /Userland/Libraries/LibGUI/InputBox.h
parent02a9e5d3f681bbf3c6157d368e95ad3183b200be (diff)
downloadserenity-7c314f38554ab95e0380cced9cf352b606391f96.zip
LibGUI: Let InputBox display an ImageWidget
InputBox can now be given a bitmap to display alongside its prompt and editor. Prompts are now optional to allow for compact dialogs.
Diffstat (limited to 'Userland/Libraries/LibGUI/InputBox.h')
-rw-r--r--Userland/Libraries/LibGUI/InputBox.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/InputBox.h b/Userland/Libraries/LibGUI/InputBox.h
index a1c5017516..8441a0faef 100644
--- a/Userland/Libraries/LibGUI/InputBox.h
+++ b/Userland/Libraries/LibGUI/InputBox.h
@@ -23,9 +23,9 @@ class InputBox : public Dialog {
public:
virtual ~InputBox() override = default;
- static ExecResult show(Window* parent_window, String& text_value, StringView prompt, StringView title, InputType input_type = InputType::Text, StringView placeholder = {});
- static ErrorOr<ExecResult> try_show(Window* parent_window, String& text_value, StringView prompt, StringView title, InputType input_type = InputType::Text, StringView placeholder = {});
- static ErrorOr<NonnullRefPtr<InputBox>> create(Window* parent_window, String text_value, StringView prompt, StringView title, InputType input_type);
+ static ExecResult show(Window* parent_window, String& text_value, StringView prompt, StringView title, InputType input_type = InputType::Text, StringView placeholder = {}, RefPtr<Gfx::Bitmap const> icon = nullptr);
+ static ErrorOr<ExecResult> try_show(Window* parent_window, String& text_value, StringView prompt, StringView title, InputType input_type = InputType::Text, StringView placeholder = {}, RefPtr<Gfx::Bitmap const> icon = nullptr);
+ static ErrorOr<NonnullRefPtr<InputBox>> create(Window* parent_window, String text_value, StringView prompt, StringView title, InputType input_type, RefPtr<Gfx::Bitmap const> icon = nullptr);
String const& text_value() const { return m_text_value; }
void set_text_value(String);
@@ -33,7 +33,7 @@ public:
void set_placeholder(StringView);
private:
- InputBox(Window* parent_window, String text_value, String title, String prompt, InputType input_type);
+ InputBox(Window* parent_window, String text_value, String title, String prompt, InputType input_type, RefPtr<Gfx::Bitmap const> icon);
virtual void on_done(ExecResult) override;
ErrorOr<void> build();
@@ -46,6 +46,8 @@ private:
RefPtr<Button> m_cancel_button;
RefPtr<TextEditor> m_text_editor;
RefPtr<Label> m_prompt_label;
+ RefPtr<Widget> m_label_container;
+ RefPtr<Gfx::Bitmap const> m_icon;
};
}