morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
frontend.hpp File Reference

morph::tui::Frontend: a morph application in a terminal. More...

#include <core/tui/MouseTracking.hpp>
#include <core/tui/Terminal.hpp>
#include <core/tui/runtime/InputSource.hpp>
#include <expected>
#include <functional>
#include <memory>
#include <string_view>
#include "../ui/backend.hpp"
#include "../ui/frontend.hpp"

Go to the source code of this file.

Classes

struct  morph::tui::FrontendConfig
 What a tui::Frontend runs on. More...
class  morph::tui::Frontend
 Runs a morph application in a terminal, on one thread. More...

Typedefs

using morph::tui::ShellFactory
 Mounts the application's shell for what the source delivered, on the terminal's widgets.

Functions

ui::FrontendOption morph::tui::frontendOption (FrontendConfig config={})
 The TUI's entry for ui::selectFrontend.

Variables

constexpr int morph::tui::kInterruptExitCode = 130
 The exit code Frontend::run returns when Ctrl+C ended the run: the shell's 128 + SIGINT, so a script can tell a user abort from a normal quit.

Detailed Description

morph::tui::Frontend: a morph application in a terminal.

Specified in docs/spec/tui/frontend.md.

Definition in file frontend.hpp.

Typedef Documentation

◆ ShellFactory

Initial value:
std::function<std::unique_ptr<ui::MountedShell>(
ui::AppContext& context, ui::IViewBackend& backend, std::expected<ui::Bundle, ui::ConnectError> opened)>
What a frontend lends the source it opens and the screens it mounts.
Definition frontend.hpp:50
Makes widgets. Each factory appends the new widget to parent, or makes a root when it is null,...
Definition backend.hpp:810

Mounts the application's shell for what the source delivered, on the terminal's widgets.

ui::ShellFactory with the backend the shell's views mount on: a terminal frontend renders through retained widgets, so the shell needs them, where a frontend that generates its views does not. Called once, on the owner.

Definition at line 30 of file frontend.hpp.

Function Documentation

◆ frontendOption()

ui::FrontendOption morph::tui::frontendOption ( FrontendConfig config = {})
nodiscard

The TUI's entry for ui::selectFrontend.

Parameters
configHanded to every Frontend the option makes.
Returns
An option named "tui", usable when standard input is a terminal.

Variable Documentation

◆ kInterruptExitCode

int morph::tui::kInterruptExitCode = 130
inlineconstexpr

The exit code Frontend::run returns when Ctrl+C ended the run: the shell's 128 + SIGINT, so a script can tell a user abort from a normal quit.

Definition at line 24 of file frontend.hpp.