mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibGUI: Set InputBox initial value to text_value string
This commit is contained in:
parent
3583b62ad3
commit
f10967e364
2 changed files with 6 additions and 4 deletions
|
@ -34,8 +34,9 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
InputBox::InputBox(Window* parent_window, const StringView& prompt, const StringView& title)
|
||||
InputBox::InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title)
|
||||
: Dialog(parent_window)
|
||||
, m_text_value(text_value)
|
||||
, m_prompt(prompt)
|
||||
{
|
||||
set_title(title);
|
||||
|
@ -48,7 +49,7 @@ InputBox::~InputBox()
|
|||
|
||||
int InputBox::show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title)
|
||||
{
|
||||
auto box = InputBox::construct(parent_window, prompt, title);
|
||||
auto box = InputBox::construct(parent_window, text_value, prompt, title);
|
||||
box->set_resizable(false);
|
||||
if (parent_window)
|
||||
box->set_icon(parent_window->icon());
|
||||
|
@ -81,6 +82,7 @@ void InputBox::build()
|
|||
|
||||
m_text_editor = label_editor_container.add<TextBox>();
|
||||
m_text_editor->set_fixed_height(19);
|
||||
m_text_editor->set_text(m_text_value);
|
||||
|
||||
auto& button_container_outer = widget.add<Widget>();
|
||||
button_container_outer.set_fixed_height(20);
|
||||
|
|
|
@ -38,13 +38,13 @@ public:
|
|||
static int show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
|
||||
|
||||
private:
|
||||
explicit InputBox(Window* parent_window, const StringView& prompt, const StringView& title);
|
||||
explicit InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
|
||||
|
||||
String text_value() const { return m_text_value; }
|
||||
|
||||
void build();
|
||||
String m_prompt;
|
||||
String m_text_value;
|
||||
String m_prompt;
|
||||
|
||||
RefPtr<Button> m_ok_button;
|
||||
RefPtr<Button> m_cancel_button;
|
||||
|
|
Loading…
Add table
Reference in a new issue