morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::Frontend Class Referenceabstract

A frontend: owns an event loop and a renderer, and runs one source's screens. More...

#include <frontend.hpp>

Inheritance diagram for morph::ui::Frontend:
morph::qt_quick::Frontend morph::tui::Frontend

Public Member Functions

 Frontend (Frontend const &)=delete
Frontend & operator= (Frontend const &)=delete
 Frontend (Frontend &&)=delete
Frontend & operator= (Frontend &&)=delete
virtual std::string_view name () const =0
 The name selectFrontend matches.
virtual int run (AppSource &source)=0
 Builds the runtime and its executor, opens source, mounts the app shell and drives the loop until AppContext::quit.

Detailed Description

A frontend: owns an event loop and a renderer, and runs one source's screens.

Definition at line 175 of file frontend.hpp.

Member Function Documentation

◆ name()

virtual std::string_view morph::ui::Frontend::name ( ) const
nodiscardpure virtual

The name selectFrontend matches.

Returns
The name.

Implemented in morph::qt_quick::Frontend, and morph::tui::Frontend.

◆ run()

virtual int morph::ui::Frontend::run ( AppSource & source)
pure virtual

Builds the runtime and its executor, opens source, mounts the app shell and drives the loop until AppContext::quit.

Tears down in reverse: the screens, then the source's connections, then the runtime, then the loop and the toolkit. A frontend leaves the first two to runApp, which fixes that order, and keeps the rest by declaring its members or locals in construction order.

Parameters
sourceWhere the screens and the models are; it outlives the call.
Returns
The exit code passed to quit; a frontend may also end the run on its own (end of input, an interrupt) with a code it documents.

Implemented in morph::qt_quick::Frontend, and morph::tui::Frontend.


The documentation for this class was generated from the following file: