One mounted screen, as its host sees it.
More...
#include <host.hpp>
|
|
| ScreenHandle (ScreenHandle const &)=delete |
|
ScreenHandle & | operator= (ScreenHandle const &)=delete |
|
| ScreenHandle (ScreenHandle &&)=delete |
|
ScreenHandle & | operator= (ScreenHandle &&)=delete |
| virtual reactive::Computed< std::string > const & | title () const =0 |
| | The screen's title: the document's title, as text.
|
| virtual reactive::Computed< bool > const & | dirty () const =0 |
| | Whether the screen has unsaved changes: the document's dirty.
|
| virtual reactive::Computed< Value > const & | identity () const =0 |
| | The screen's identity: the document's identity, null when it declares none. A host re-keys a tab when it changes.
|
| virtual ScreenHead * | head () noexcept |
| | The screen's head beside its title, for a shell to show above it.
|
| virtual void | requestClose (std::function< void(bool closed)> done)=0 |
| | Asks the screen to close (spec 6 §3).
|
| virtual void | forceClose ()=0 |
| | Closes the screen without asking: skips onClose and the close guard, runs onUnmount, and answers a pending requestClose with true. For application quit.
|
| virtual bool | canSave () const |
| | Whether the screen can save its changes: a document screen that declares onSave, or a host screen whose handle implements save. A close guard offers save and close only when this is true.
|
| virtual void | save (std::function< void(bool clean)> done) |
| | Saves the screen's changes (spec 6 §15) and answers whether it is then clean.
|
One mounted screen, as its host sees it.
The host reads title, dirty and identity to show the tab and the unsaved indicator, and closes the screen through requestClose. It never destroys a handle whose close is pending, except after forceClose.
Definition at line 82 of file host.hpp.
◆ title()
| virtual reactive::Computed< std::string > const & morph::ui::ScreenHandle::title |
( |
| ) |
const |
|
nodiscardpure virtual |
The screen's title: the document's title, as text.
- Returns
- It; it keeps its last value once the screen is closed.
Implemented in morph::ui::Explorer.
◆ dirty()
Whether the screen has unsaved changes: the document's dirty.
- Returns
- It; false once the screen is closed.
Implemented in morph::ui::Explorer.
◆ identity()
The screen's identity: the document's identity, null when it declares none. A host re-keys a tab when it changes.
- Returns
- It; it keeps its last value once the screen is closed.
Implemented in morph::ui::Explorer.
◆ head()
| virtual ScreenHead * morph::ui::ScreenHandle::head |
( |
| ) |
|
|
inlinenodiscardvirtualnoexcept |
The screen's head beside its title, for a shell to show above it.
- Returns
- It, valid as long as the handle: a document screen's (empty values when the document declares no head); null for a host screen unless its handle overrides this.
Definition at line 107 of file host.hpp.
◆ requestClose()
| virtual void morph::ui::ScreenHandle::requestClose |
( |
std::function< void(bool closed)> | done | ) |
|
|
pure virtual |
Asks the screen to close (spec 6 §3).
done is called exactly once, posted to the owner, never from inside the document's own handler: with true when the screen closed, false when it stays open. A request while one is pending joins it, and is answered with the same outcome.
- Parameters
-
| done | Called with the outcome. |
Implemented in morph::ui::Explorer.
◆ forceClose()
| virtual void morph::ui::ScreenHandle::forceClose |
( |
| ) |
|
|
pure virtual |
Closes the screen without asking: skips onClose and the close guard, runs onUnmount, and answers a pending requestClose with true. For application quit.
Implemented in morph::ui::Explorer.
◆ canSave()
| virtual bool morph::ui::ScreenHandle::canSave |
( |
| ) |
const |
|
inlinenodiscardvirtual |
Whether the screen can save its changes: a document screen that declares onSave, or a host screen whose handle implements save. A close guard offers save and close only when this is true.
- Returns
- It; false unless a derived handle says otherwise.
Definition at line 124 of file host.hpp.
◆ save()
| virtual void morph::ui::ScreenHandle::save |
( |
std::function< void(bool clean)> | done | ) |
|
|
inlinevirtual |
Saves the screen's changes (spec 6 §15) and answers whether it is then clean.
A document screen runs onSave, waits until nothing pending is left, and answers true when dirty is then not true. A save while one waits joins it. A screen that cannot save answers false at once. done is not called when the screen closes before the save has finished.
- Parameters
-
| done | Called with whether the screen is clean. |
Definition at line 133 of file host.hpp.
The documentation for this class was generated from the following file: