|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The workspace's tabs with no widgets: which screens are open, in which order, which is active, and how they open, close and are recorded (spec 6 §7, §15). More...
#include <workspace_model.hpp>
Public Member Functions | |
| WorkspaceModel (reactive::Runtime &runtime, DocumentScreenHost &host, WorkspaceModelOptions options) | |
| An empty workspace. | |
| ~WorkspaceModel () | |
| Unmounts every screen without asking, newest first. | |
| WorkspaceModel (WorkspaceModel const &)=delete | |
| WorkspaceModel & | operator= (WorkspaceModel const &)=delete |
| WorkspaceModel (WorkspaceModel &&)=delete | |
| WorkspaceModel & | operator= (WorkspaceModel &&)=delete |
| std::expected< WorkspaceTabId, MountError > | open (std::string_view screenId, ParamMap const ¶ms) |
| Opens a screen, or focuses the tab that already shows it; the tab opened or focused is the active one. | |
| std::size_t | start (WorkspaceStart const &how) |
| Opens the start screens: with resume, every recorded route whose screen is known and available, in order, and the fallback when none of them opened; otherwise the start screen. The first tab opened is the active one. | |
| void | activate (WorkspaceTabId tab) |
| Shows a tab and makes it the most recently used. | |
| void | next () |
| Shows the next tab in most-recently-used order (Ctrl+Tab). Repeated calls walk the order as it was at the first of them; any other activation starts a new walk. | |
| void | previous () |
| Shows the previous tab in most-recently-used order (Ctrl+Shift+Tab). | |
| void | close (WorkspaceTabId tab, std::function< void(bool)> done) |
| Closes a tab through its screen's close protocol. | |
| void | closeOthers (WorkspaceTabId tab, std::function< void(bool)> done) |
| Closes every tab but one, one at a time, stopping at the first veto. | |
| void | closeAll (std::function< void(bool)> done) |
| Closes every tab, one at a time, stopping at the first veto. | |
| void | closeSaved (std::function< void(bool)> done) |
| Closes every tab without unsaved changes, one at a time, stopping at the first veto. | |
| void | forceCloseAll () |
| Closes every tab without asking, newest first: what signing out does, since no close guard may keep a screen of the principal who is leaving. | |
| void | flushRecord () |
| Writes the record now, cancelling a pending debounced write: what sign-out does before the session is cleared. | |
| std::vector< std::string > | record () const |
| The record as it would be written now: the routes of the open tabs, in order. | |
| reactive::Computed< std::vector< WorkspaceTabState > > const & | tabs () const |
| The open tabs, in order, each with its screen, identity, title and unsaved state. A tab's values follow its handle. | |
| reactive::Computed< std::optional< WorkspaceTabId > > const & | active () const |
| The active tab. | |
| std::vector< WorkspaceTabId > | order () const |
| The open tabs' ids, in order, read without tracking: the order tabs() lists them in. | |
| ScreenHandle * | handleOf (WorkspaceTabId tab) const noexcept |
| A tab's screen handle: what a client remounts for development reload and inspects. | |
The workspace's tabs with no widgets: which screens are open, in which order, which is active, and how they open, close and are recorded (spec 6 §7, §15).
Opening a screen whose identity an open tab already has focuses that tab, a singleton screen has one tab, and a reuseEmpty screen opened with an identity replaces its tab with no identity and no unsaved changes. Closing runs each screen's close protocol (spec 6 §3), one tab at a time, and a walk over several tabs stops at the first veto. next and previous walk the most recently used order. The page each tab shows is the application's: mountPage makes it and mounts the screen there, unmountPage is told when it goes. Neither copyable nor movable; owned by the owner thread of its runtime.
Definition at line 126 of file workspace_model.hpp.
|
inline |
An empty workspace.
| runtime | The runtime the screens' reactive nodes belong to. Borrowed. |
| host | Answers identities and routes. Borrowed; it outlives the model. |
| options | The screens' catalog facts, the record, and the page callbacks. |
| std::invalid_argument | when mountPage is empty. |
Definition at line 133 of file workspace_model.hpp.
|
inline |
Unmounts every screen without asking, newest first.
Definition at line 148 of file workspace_model.hpp.
|
inline |
Opens a screen, or focuses the tab that already shows it; the tab opened or focused is the active one.
| screenId | The screen id. |
| params | Its params. |
Definition at line 164 of file workspace_model.hpp.
|
inline |
Opens the start screens: with resume, every recorded route whose screen is known and available, in order, and the fallback when none of them opened; otherwise the start screen. The first tab opened is the active one.
| how | The start screen, the fallback and the record. |
Definition at line 201 of file workspace_model.hpp.
|
inline |
Shows a tab and makes it the most recently used.
| tab | The tab. |
| std::out_of_range | for a tab the model does not hold. |
Definition at line 234 of file workspace_model.hpp.
|
inline |
Shows the next tab in most-recently-used order (Ctrl+Tab). Repeated calls walk the order as it was at the first of them; any other activation starts a new walk.
Definition at line 238 of file workspace_model.hpp.
|
inline |
Shows the previous tab in most-recently-used order (Ctrl+Shift+Tab).
Definition at line 241 of file workspace_model.hpp.
|
inline |
Closes a tab through its screen's close protocol.
| tab | The tab. |
| done | Called once with whether it closed; may be empty. |
| std::out_of_range | for a tab the model does not hold. |
Definition at line 247 of file workspace_model.hpp.
|
inline |
Closes every tab but one, one at a time, stopping at the first veto.
| tab | The tab kept. |
| done | Called once with whether every other tab closed; may be empty. |
| std::out_of_range | for a tab the model does not hold. |
Definition at line 253 of file workspace_model.hpp.
|
inline |
Closes every tab, one at a time, stopping at the first veto.
| done | Called once with whether every tab closed; may be empty. |
Definition at line 267 of file workspace_model.hpp.
|
inline |
Closes every tab without unsaved changes, one at a time, stopping at the first veto.
| done | Called once with whether each of them closed; may be empty. |
Definition at line 271 of file workspace_model.hpp.
|
inline |
Closes every tab without asking, newest first: what signing out does, since no close guard may keep a screen of the principal who is leaving.
Definition at line 284 of file workspace_model.hpp.
|
inline |
Writes the record now, cancelling a pending debounced write: what sign-out does before the session is cleared.
Definition at line 292 of file workspace_model.hpp.
|
inlinenodiscard |
The record as it would be written now: the routes of the open tabs, in order.
Definition at line 301 of file workspace_model.hpp.
|
inlinenodiscard |
The open tabs, in order, each with its screen, identity, title and unsaved state. A tab's values follow its handle.
Definition at line 315 of file workspace_model.hpp.
|
inlinenodiscard |
The active tab.
Definition at line 319 of file workspace_model.hpp.
|
inlinenodiscard |
The open tabs' ids, in order, read without tracking: the order tabs() lists them in.
Definition at line 323 of file workspace_model.hpp.
|
inlinenodiscardnoexcept |
A tab's screen handle: what a client remounts for development reload and inspects.
| tab | The tab. |
Definition at line 335 of file workspace_model.hpp.