|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Runs a morph application in a terminal, on one thread. More...
#include <frontend.hpp>
Public Member Functions | |
| Frontend (FrontendConfig config={}) | |
| std::string_view | name () const override |
| The name --ui= and MORPH_UI select this frontend by. | |
| int | run (ui::AppSource &source) override |
| Runs the application the source opens on the calling thread until it quits or the input ends. | |
| Public Member Functions inherited from morph::ui::Frontend | |
| Frontend (Frontend const &)=delete | |
| Frontend & | operator= (Frontend const &)=delete |
| Frontend (Frontend &&)=delete | |
| Frontend & | operator= (Frontend &&)=delete |
Runs a morph application in a terminal, on one thread.
run builds a caller-driven exec::IoLoop, a LoopExecutor on it (the reactive runtime's owner and every bridge handler's callback executor), the runtime, a core::tui::Screen and a TuiRuntime, then runs the source through ui::runApp: it opens the source, mounts the shell through FrontendConfig::mountShell when the source is ready, and pumps input until AppContext::quit() or the end of input. Sockets, timers, bridge callbacks and input all run on the thread that called run. Tab and Shift+Tab move the focus (inside an open dialog only, while one is open); Esc ends a drag wherever the focus is; Ctrl+C quits; a resize re-fits the view. Each input event is followed by a frame before the next one is handled, and redraws are coalesced to one per loop turn.
Definition at line 58 of file frontend.hpp.
|
explicit |
| config | The terminal, the input and the mouse mode; the defaults use the process's terminal. |
|
nodiscardoverridevirtual |
|
overridevirtual |
Runs the application the source opens on the calling thread until it quits or the input ends.
| source | Opened once the runtime exists, and closed before it is destroyed. |
| std::runtime_error | when the terminal cannot be initialised; std::invalid_argument when FrontendConfig::mountShell is empty; whatever the source or the shell factory throws. |
Implements morph::ui::Frontend.