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

Keeps the route of the screen a shell shows in a history, and opens the route of an entry the user moves to (spec 3 §10). More...

#include <route_history.hpp>

Public Member Functions

 RouteHistory (IHistory &history, std::function< void(std::string const &route)> open)
 A history over history, which it keeps and follows from now on.
 RouteHistory (RouteHistory const &)=delete
RouteHistory & operator= (RouteHistory const &)=delete
 RouteHistory (RouteHistory &&)=delete
RouteHistory & operator= (RouteHistory &&)=delete
std::string const & initial () const noexcept
 The route the history held when this was made: a reloaded page's, or a shared link's.
void shown (std::string const &route)
 The shell now shows a screen whose route is route.

Detailed Description

Keeps the route of the screen a shell shows in a history, and opens the route of an entry the user moves to (spec 3 §10).

The shell opens initial() first, when it can, and calls shown after it mounts each screen. The first shown replaces the entry the history started on, so opening the first screen does not add a step back to an empty page; each later call adds an entry, unless the route is already the current entry's. Moving back or forward calls open, which shows the route's screen, or the start screen when the route cannot be opened, before it returns. The first screen it shows replaces the entry instead of adding one, so a refused route is not left in the history; a screen shown after that, such as a redirect, adds an entry as it would anywhere else.

Definition at line 72 of file route_history.hpp.

Constructor & Destructor Documentation

◆ RouteHistory()

morph::ui::RouteHistory::RouteHistory ( IHistory & history,
std::function< void(std::string const &route)> open )
inline

A history over history, which it keeps and follows from now on.

Parameters
historyThe history. Borrowed: it outlives this.
openShows the screen of a route the user moved to, calling shown before it returns. It may destroy this.

Definition at line 78 of file route_history.hpp.

Member Function Documentation

◆ initial()

std::string const & morph::ui::RouteHistory::initial ( ) const
inlinenodiscardnoexcept

The route the history held when this was made: a reloaded page's, or a shared link's.

Returns
It, or empty for none.

Definition at line 111 of file route_history.hpp.

◆ shown()

void morph::ui::RouteHistory::shown ( std::string const & route)
inline

The shell now shows a screen whose route is route.

Parameters
routeThe route; empty, for a screen with none, leaves the history as it is, so after a move back or forward the next screen with a route replaces the moved-to entry.

Definition at line 116 of file route_history.hpp.


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