Jazz2/Editor/Shell/TextPrompt.h file

Namespaces

namespace Jazz2
Root namespace of Jazz² Resurrection.
namespace Jazz2::UI
User interface and menus.
namespace Jazz2::UI::Windows
Toolkit of windows, panels and controls, compiled only if WITH_UI_WINDOWS.
namespace Jazz2::Editor

Functions

auto ShowModal(Surface& surface, std::unique_ptr<Element> dialog) -> Element*
Shows a dialog in the middle of the screen, the rest of the interface can't be used until it's closed.
auto ShowModeless(Surface& surface, std::unique_ptr<Element> dialog, Function<void()>&& onClosed = {}) -> Element*
Shows a window in the middle of the screen, the rest of the interface and the level can still be used.
void ShowTextPrompt(Surface& surface, StringView title, StringView label, StringView initialText, std::int32_t maxLength, Function<void(StringView)>&& onConfirmed)
Asks for a line of text in a small dialog.

Function documentation

Element* ShowModal(Surface& surface, std::unique_ptr<Element> dialog)

Shows a dialog in the middle of the screen, the rest of the interface can't be used until it's closed.

A click outside of it doesn't close it, it's closed by its buttons, its cross or Escape. Returns the dialog.

Element* ShowModeless(Surface& surface, std::unique_ptr<Element> dialog, Function<void()>&& onClosed = {})

Shows a window in the middle of the screen, the rest of the interface and the level can still be used.

A click outside of it doesn't close it, it's closed by its buttons, its cross or Escape. onClosed is called when it's closed. Returns the window.

void ShowTextPrompt(Surface& surface, StringView title, StringView label, StringView initialText, std::int32_t maxLength, Function<void(StringView)>&& onConfirmed)

Asks for a line of text in a small dialog.

onConfirmed gets the text, trimmed, when it's confirmed by Enter or the button, not if the dialog is cancelled or the text is empty.