Skip to main content

Module selection_toolbar

Module selection_toolbar 

Source
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:

§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§

SelectionToolbarActions
Which clipboard verbs apply to the current selection — the enabled set, not a menu layout.
SelectionToolbarRequest
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§

SelectionToolbarPolicy
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_policy call cannot silently override it.
selection_toolbar_builder
The installed builder, or None when nothing has installed one.
selection_toolbar_policy
The process-wide toolbar policy, SelectionToolbarPolicy::Framework until 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§

SelectionToolbarBuilder
Builds the view a framework-drawn selection toolbar floats.