InputBox.h 898 B

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