Expand description
The selection-toolbar seam: what a text field asks for when it has a selection, and who draws it.
§Two routes, one request
A “copy / cut / paste / select all” bar over a selection is drawn by the
platform on iOS (UIEditMenuInteraction — the system owns its look, its
placement and its animation) and by the framework everywhere else. Both
routes need the same facts — where the selection is, which verbs apply, and
whether a menu is wanted right now — so a focused field publishes one
SelectionToolbarRequest per paint and the two routes diverge downstream
of it:
SelectionToolbarPolicy::Native: the request surfaces onRenderRoot::selection_toolbarwith a generation a shell diffs, and the shell asks the platform to present its own menu.SelectionToolbarPolicy::Framework: the field hosts its own toolbar pod through the overlay portal (seecrate::overlay) — and still publishes the request, which costs a pointer-sized write and keeps one code path rather than two.
§Process-global slots
The policy and the builder are process-global Mutex slots, mirroring
frust_shell_common::theme_override’s contract exactly: callable from any
thread (documented, not enforced), read on the UI thread by whoever needs
them, and last-writer-wins. They live in frust-core rather than beside
their nearest neighbours in the shells because
RenderRoot itself is a reader — a slot a shell
owned would be unreachable from here without inverting the layer
dependencies.
The builder is what a design system installs so a text field can float
someone’s toolbar without frust-core knowing a single widget type: it
returns an AnyView over () (the pod’s own state; see crate::overlay
for why an overlay pod is state-independent of the app), so the catalog that
installs it decides the whole look.
Structs§
- Selection
Toolbar Actions - Which clipboard verbs apply to the current selection — the enabled set, not a menu layout.
- Selection
Toolbar Request - One focused field’s published “here is my selection, these verbs apply to it, and this is whether a menu is wanted over it right now”.
Enums§
- Selection
Toolbar Policy - Who draws the selection toolbar.
Functions§
- install_
selection_ toolbar_ builder_ if_ unset - Install the builder only if none is installed, reporting whether it took.
- lock_
selection_ toolbar_ policy - Declare the policy a shell’s platform REQUIRES, locking the slot so a
later
set_selection_toolbar_policycall cannot silently override it. - selection_
toolbar_ builder - The installed builder, or
Nonewhen nothing has installed one. - selection_
toolbar_ policy - The process-wide toolbar policy,
SelectionToolbarPolicy::Frameworkuntil something sets otherwise. - set_
selection_ toolbar_ builder - Install the selection-toolbar builder, replacing whatever was there.
- set_
selection_ toolbar_ policy - Choose who draws the selection toolbar, process-wide.
Type Aliases§
- Selection
Toolbar Builder - Builds the view a framework-drawn selection toolbar floats.