|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API void MayaFlux::Portal::Forma::ask | ( | std::string | title, |
| std::string | initial, | ||
| AskValidator | validator, | ||
| AskCallback | callback ) |
Open a one line text prompt and report what the user typed.
Requires Portal::Forma to be initialized and the engine running. The window holds one text field with the focus, started on initial with the cursor at its end. Enter accepts the text, Escape cancels, and closing the window cancels. The callback fires exactly once, on the event thread, so it must not block, and the window closes as it fires.
When a validator is given it runs on every edit. Text it refuses is drawn in a warning colour and Enter does nothing until the text is accepted, so the callback only ever receives text the validator took.
| title | Window title, with a note that Enter accepts and Escape cancels. |
| initial | Starting text. |
| validator | Accepts or refuses the text. Empty accepts everything. |
| callback | Invoked once with the text or nullopt. |
Definition at line 94 of file Prompt.cpp.
References MayaFlux::Portal::Forma::internal::ask_in(), MayaFlux::Portal::Forma::internal::atelier(), MayaFlux::Portal::Forma::internal::Atelier::batch_slice(), MayaFlux::Portal::Forma::internal::Atelier::create_surface(), MayaFlux::Portal::Forma::internal::Atelier::create_window(), MayaFlux::Portal::Text::TypeFaceFoundry::instance(), and MayaFlux::Portal::Graphics::TRIANGLE_LIST.
Referenced by ask(), and MayaFlux::detail::ask_one().