InputBox.h 751 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGUI/Dialog.h>
  8. namespace GUI {
  9. class InputBox : public Dialog {
  10. C_OBJECT(InputBox)
  11. public:
  12. virtual ~InputBox() override;
  13. static int show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
  14. private:
  15. explicit InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
  16. String text_value() const { return m_text_value; }
  17. void build();
  18. String m_text_value;
  19. String m_prompt;
  20. RefPtr<Button> m_ok_button;
  21. RefPtr<Button> m_cancel_button;
  22. RefPtr<TextEditor> m_text_editor;
  23. };
  24. }