pub struct SelectionToolbarActions {
pub copy: bool,
pub cut: bool,
pub paste: bool,
pub select_all: bool,
}Expand description
The selection-toolbar seam: the request a text field publishes when it
has a selection (SelectionToolbarRequest/SelectionToolbarActions),
and the knobs that decide who draws it.
set_selection_toolbar_policy chooses
SelectionToolbarPolicy::Framework (the default — a field floats its
own pod through the overlay portal) or SelectionToolbarPolicy::Native
(the platform’s own edit menu, e.g. iOS’s UIEditMenuInteraction) — see
that type’s own docs for the two-route split. This is not an
unconditional free choice, though: a platform shell whose system owns the
menu can LOCK it instead, with frust_core::lock_selection_toolbar_policy
— once locked, set_selection_toolbar_policy is refused rather than
obeyed, so an app cannot silently undo a platform requirement it doesn’t
know exists. iOS’s shell locks SelectionToolbarPolicy::Native at
start-up for exactly this reason: a framework-drawn toolbar’s own Paste
button would break the exemption that keeps iOS’s per-app paste-permission
prompt from firing on every paste.
set_selection_toolbar_builder installs the view a Framework-policy
pod floats, replacing whatever the framework’s own baseline (installed
at bootstrap, before the first frame) or an earlier design system already
installed. A design system’s own installer should reach for
frust_core::install_selection_toolbar_builder_if_unset instead — the
cooperative, set-if-unset half of the same pair — so two catalogs linked
into one binary never fight over the slot, and neither ever undoes an
app’s own explicit override.
use frust::{
SelectionToolbarPolicy, lock_selection_toolbar_policy, set_selection_toolbar_policy,
};
// A shell whose platform owns its own system edit menu locks the route,
// so that requirement wins no matter what app code does afterward.
let claimed = lock_selection_toolbar_policy(SelectionToolbarPolicy::Native);
assert!(claimed, "the first claim always takes the lock");
// An app's later override is refused rather than obeyed once locked.
set_selection_toolbar_policy(SelectionToolbarPolicy::Framework);Which clipboard verbs apply to the current selection — the enabled set, not a menu layout.
A field computes these from its own state (an empty selection has nothing to copy; a read-only field cannot cut or paste; a field whose whole content is already selected offers no select-all), and whoever draws the menu decides how to present a disabled verb — by omitting it, greying it, or ignoring the distinction.
Fields§
§copy: boolCopy the selection to the host clipboard.
cut: boolCut the selection to the host clipboard.
paste: boolReplace the selection with the host clipboard’s contents.
select_all: boolSelect the field’s whole content.
Trait Implementations§
Source§impl Clone for SelectionToolbarActions
impl Clone for SelectionToolbarActions
Source§fn clone(&self) -> SelectionToolbarActions
fn clone(&self) -> SelectionToolbarActions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SelectionToolbarActions
Source§impl Debug for SelectionToolbarActions
impl Debug for SelectionToolbarActions
Source§impl Default for SelectionToolbarActions
impl Default for SelectionToolbarActions
Source§fn default() -> SelectionToolbarActions
fn default() -> SelectionToolbarActions
impl Eq for SelectionToolbarActions
Source§impl Hash for SelectionToolbarActions
impl Hash for SelectionToolbarActions
Source§impl PartialEq for SelectionToolbarActions
impl PartialEq for SelectionToolbarActions
impl StructuralPartialEq for SelectionToolbarActions
Auto Trait Implementations§
impl Freeze for SelectionToolbarActions
impl RefUnwindSafe for SelectionToolbarActions
impl Send for SelectionToolbarActions
impl Sync for SelectionToolbarActions
impl Unpin for SelectionToolbarActions
impl UnsafeUnpin for SelectionToolbarActions
impl UnwindSafe for SelectionToolbarActions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.