mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021, networkException <networkexception@serenityos.org>
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGUI/Dialog.h>
|
|
|
|
namespace GUI {
|
|
|
|
enum class InputType {
|
|
Text,
|
|
Password
|
|
};
|
|
|
|
class InputBox : public Dialog {
|
|
C_OBJECT(InputBox)
|
|
public:
|
|
virtual ~InputBox() override = default;
|
|
|
|
static ExecResult show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text);
|
|
|
|
DeprecatedString const& text_value() const { return m_text_value; }
|
|
void set_text_value(DeprecatedString text_value);
|
|
|
|
private:
|
|
explicit InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type);
|
|
|
|
virtual void on_done(ExecResult) override;
|
|
void build(InputType input_type);
|
|
|
|
DeprecatedString m_text_value;
|
|
DeprecatedString m_prompt;
|
|
DeprecatedString m_placeholder;
|
|
|
|
RefPtr<Button> m_ok_button;
|
|
RefPtr<Button> m_cancel_button;
|
|
RefPtr<TextEditor> m_text_editor;
|
|
};
|
|
|
|
}
|