|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Tabs over screens: a tab bar over a WorkspaceModel, one screen instance per tab, mounted into the tab's page through DocumentScreenHost::mountInto, with the screen's head row above it or, when the placement is External, mounted by the host instead. More...
#include <workspace.hpp>
Public Member Functions | |
| Workspace (reactive::Runtime &runtime, IViewBackend &backend, DocumentScreenHost &host, WorkspaceOptions options={}, ContainerWidget *parent=nullptr, HeadPlacement headPlacement=HeadPlacement::InPage) | |
The shell, its tab bar appended to parent. | |
| ~Workspace () | |
| Unmounts every screen without asking, newest first, then the pages. | |
| Workspace (Workspace const &)=delete | |
| Workspace & | operator= (Workspace const &)=delete |
| Workspace (Workspace &&)=delete | |
| Workspace & | operator= (Workspace &&)=delete |
| TabsWidget & | root () noexcept |
| The tab bar: the shell's root widget, which the host places. | |
| WorkspaceModel & | model () noexcept |
| The tab logic the bar shows, for an application that reads or drives it by tab id. | |
| std::expected< std::size_t, MountError > | open (std::string_view screenId, ParamMap const ¶ms) |
| Opens a screen, or focuses the tab that already shows it (WorkspaceModel::open). | |
| std::size_t | start (WorkspaceStart const &how) |
| Opens the start screens (WorkspaceModel::start). | |
| 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. | |
| void | activate (std::size_t index) |
| 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 (std::size_t index, std::function< void(bool)> done) |
| Closes a tab through its screen's close protocol. | |
| void | closeOthers (std::size_t index, 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. | |
| std::optional< std::size_t > | active () const |
| The active tab's index. | |
| ScreenHandle * | handleOf (std::size_t index) const noexcept |
| The screen handle of a tab: what a client remounts for development reload and inspects. | |
| ScreenHandle * | activeHandle () const |
| The active tab's screen handle. | |
| Node | headRowForActive () const |
| The active tab's head row, the same reactive content headRow builds for the body-embedded rendering, for a host that mounts it elsewhere (a shell's own top bar, say). Never null: an invisible, empty row stands in for "no active tab" rather than a null Node, since a caller mounting this may not expect to handle one. | |
| 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. | |
| std::vector< WorkspaceTab > | tabs () const |
| The open tabs, in order. | |
Tabs over screens: a tab bar over a WorkspaceModel, one screen instance per tab, mounted into the tab's page through DocumentScreenHost::mountInto, with the screen's head row above it or, when the placement is External, mounted by the host instead.
The model holds the tab logic: tabs keep the order they were opened in, opening a screen whose identity an open tab already has focuses that tab, a singleton screen has one tab, and closing runs each screen's close protocol (spec 6 ยง3), one tab at a time, a walk over several tabs stopping at the first veto. The bar shows the model's tabs and takes Ctrl+Tab, Ctrl+Shift+Tab and Ctrl+W, which documents may not declare. Neither copyable nor movable; owned by the owner thread of its runtime.
Definition at line 63 of file workspace.hpp.
|
inline |
The shell, its tab bar appended to parent.
| runtime | The runtime the screens' reactive nodes belong to. Borrowed. |
| backend | The backend the bar and the pages are made with. Borrowed. |
| host | What mounts the screens. Borrowed; it outlives the shell. |
| options | The screens' catalog facts. |
| parent | The container the shell is appended to; null makes it a backend root. |
| headPlacement | Where the active screen's head row is drawn. External leaves the host to mount headRowForActive() itself, so a shell with its own top bar shows the head once. |
Definition at line 73 of file workspace.hpp.
|
inline |
Unmounts every screen without asking, newest first, then the pages.
Definition at line 116 of file workspace.hpp.
|
inlinenodiscardnoexcept |
The tab bar: the shell's root widget, which the host places.
Definition at line 125 of file workspace.hpp.
|
inlinenodiscardnoexcept |
The tab logic the bar shows, for an application that reads or drives it by tab id.
Definition at line 129 of file workspace.hpp.
|
inline |
Opens a screen, or focuses the tab that already shows it (WorkspaceModel::open).
| screenId | The screen id. |
| params | Its params. |
Definition at line 135 of file workspace.hpp.
|
inline |
Opens the start screens (WorkspaceModel::start).
| how | The start screen, the fallback and the record. |
Definition at line 146 of file workspace.hpp.
|
inline |
Writes the record now, cancelling a pending debounced write: what sign-out does before the session is cleared.
Definition at line 150 of file workspace.hpp.
|
inlinenodiscard |
The record as it would be written now: the routes of the open tabs, in order.
Definition at line 154 of file workspace.hpp.
|
inline |
Shows a tab and makes it the most recently used.
| index | The tab; past the last one does nothing. |
Definition at line 158 of file workspace.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 166 of file workspace.hpp.
|
inline |
Shows the previous tab in most-recently-used order (Ctrl+Shift+Tab).
Definition at line 169 of file workspace.hpp.
|
inline |
Closes a tab through its screen's close protocol.
| index | The tab. |
| done | Called once with whether it closed; may be empty. |
Definition at line 174 of file workspace.hpp.
|
inline |
Closes every tab but one, one at a time, stopping at the first veto.
| index | The tab kept; past the last one closes every tab. |
| done | Called once with whether every other tab closed; may be empty. |
Definition at line 188 of file workspace.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 199 of file workspace.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 203 of file workspace.hpp.
|
inlinenodiscard |
The active tab's index.
Definition at line 207 of file workspace.hpp.
|
inlinenodiscardnoexcept |
The screen handle of a tab: what a client remounts for development reload and inspects.
| index | The tab's index. |
Definition at line 218 of file workspace.hpp.
|
inlinenodiscard |
The active tab's screen handle.
Definition at line 225 of file workspace.hpp.
|
inlinenodiscard |
The active tab's head row, the same reactive content headRow builds for the body-embedded rendering, for a host that mounts it elsewhere (a shell's own top bar, say). Never null: an invisible, empty row stands in for "no active tab" rather than a null Node, since a caller mounting this may not expect to handle one.
Definition at line 235 of file workspace.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 248 of file workspace.hpp.
|
inlinenodiscard |
The open tabs, in order.
Definition at line 252 of file workspace.hpp.