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

What a frontend lends the source it opens and the screens it mounts. More...

#include <frontend.hpp>

Public Member Functions

 AppContext (AppContext const &)=delete
AppContext & operator= (AppContext const &)=delete
 AppContext (AppContext &&)=delete
AppContext & operator= (AppContext &&)=delete
virtual reactive::Runtime & runtime ()=0
 The runtime the screens are mounted in. Owned by the frontend.
virtual exec::IExecutor & executor ()=0
 The runtime's owner, and the callback executor of every bridge handler the source and the screens make.
virtual Scheduler & scheduler ()=0
 Timers that fire on the owner executor.
virtual exec::IoLoop * ioLoop ()=0
 The I/O loop the frontend runs on, for sockets and timers that share its one thread.
virtual void quit (int exitCode=0)=0
 Makes Frontend::run return once the current event has been handled.

Detailed Description

What a frontend lends the source it opens and the screens it mounts.

Everything it lends (the runtime, the executor, the scheduler, the loop) outlives the screens and the connections made with it: a frontend destroys those, through runApp, before its runtime.

Definition at line 50 of file frontend.hpp.

Member Function Documentation

◆ runtime()

virtual reactive::Runtime & morph::ui::AppContext::runtime ( )
pure virtual

The runtime the screens are mounted in. Owned by the frontend.

Returns
The runtime.

◆ executor()

virtual exec::IExecutor & morph::ui::AppContext::executor ( )
pure virtual

The runtime's owner, and the callback executor of every bridge handler the source and the screens make.

Returns
The executor; the same one as runtime().owner().

◆ scheduler()

virtual Scheduler & morph::ui::AppContext::scheduler ( )
pure virtual

Timers that fire on the owner executor.

It honours every guarantee of reactive::Scheduler, as docs/spec/reactive/control.md ("The `Scheduler` contract") states them.

Returns
The scheduler.

◆ ioLoop()

virtual exec::IoLoop * morph::ui::AppContext::ioLoop ( )
pure virtual

The I/O loop the frontend runs on, for sockets and timers that share its one thread.

Returns
The loop, or null when the frontend has none (Qt Quick).

◆ quit()

virtual void morph::ui::AppContext::quit ( int exitCode = 0)
pure virtual

Makes Frontend::run return once the current event has been handled.

Called before the loop runs (from AppSource::open, or from mounting the shell), it still ends the run once the loop starts.

Parameters
exitCodeWhat run returns.

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