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

Builds widgets for nodes and wires their props and callbacks. More...

#include <mount.hpp>

Public Member Functions

 Mounter (reactive::Runtime &runtime, IViewBackend &backend) noexcept
Widget * mount (reactive::Scope &scope, Node const &node, ContainerWidget *parent)
 Mounts node under parent; scope owns its widgets and bindings.
Widget * mountRoot (reactive::Scope &scope, Node const &node, ContainerWidget *parent)
 Mounts node as mount does, as a mount of its own: the first autofocus widget it mounts, in document order, takes keyboard focus once the whole of it has mounted.
bool focus (std::string_view focusId)
 Moves keyboard focus to the mounted widget whose focusId is focusId.

Detailed Description

Builds widgets for nodes and wires their props and callbacks.

One per Mounted. It must outlive every scope it mounted into: a Switch, Tabs, Dialog, ForEach or Table binding calls back into it to mount content later.

Definition at line 213 of file mount.hpp.

Constructor & Destructor Documentation

◆ Mounter()

morph::ui::detail::Mounter::Mounter ( reactive::Runtime & runtime,
IViewBackend & backend )
inlinenoexcept
Parameters
runtimeThe runtime bindings are made in. Borrowed.
backendMakes the widgets. Borrowed.

Definition at line 217 of file mount.hpp.

Member Function Documentation

◆ mount()

Widget * morph::ui::detail::Mounter::mount ( reactive::Scope & scope,
Node const & node,
ContainerWidget * parent )
inline

Mounts node under parent; scope owns its widgets and bindings.

A node's widget is adopted first, then its bindings, then its children, so destroying the scope destroys bindings before their widget and children before their parent.

Parameters
scopeOwns everything mounted.
nodeThe node; null mounts nothing.
parentThe container to append to, or null for a root.
Returns
The node's widget, or null for a null node.

Definition at line 228 of file mount.hpp.

◆ mountRoot()

Widget * morph::ui::detail::Mounter::mountRoot ( reactive::Scope & scope,
Node const & node,
ContainerWidget * parent )
inline

Mounts node as mount does, as a mount of its own: the first autofocus widget it mounts, in document order, takes keyboard focus once the whole of it has mounted.

Parameters
scopeOwns everything mounted.
nodeThe node; null mounts nothing.
parentThe container to append to, or null for a root.
Returns
The node's widget, or null for a null node.

Definition at line 248 of file mount.hpp.

◆ focus()

bool morph::ui::detail::Mounter::focus ( std::string_view focusId)
inline

Moves keyboard focus to the mounted widget whose focusId is focusId.

Of several such widgets (rows of a list), the one mounted first is taken. A backend that cannot move focus leaves it where it was; the request was still made.

Parameters
focusIdThe name.
Returns
Whether a mounted widget has that name.

Definition at line 258 of file mount.hpp.


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