pub struct OverlayPortalView<State>where
State: 'static,{ /* private fields */ }Expand description
A declarative overlay portal. See overlay_portal.
Implementations§
Source§impl<State> OverlayPortalView<State>where
State: 'static,
impl<State> OverlayPortalView<State>where
State: 'static,
Sourcepub fn overlay(
self,
overlay: Option<AnyView<State>>,
) -> OverlayPortalView<State>
pub fn overlay( self, overlay: Option<AnyView<State>>, ) -> OverlayPortalView<State>
The floated surface: Some mounts it, None drops it after the next
paint.
The view is diffed against the same application state the portal itself is, so the surface reads and writes app state exactly like the child does — it is a logical child of this call site that happens to be painted elsewhere.
Sourcepub fn placement(self, placement: OverlayPlacement) -> OverlayPortalView<State>
pub fn placement(self, placement: OverlayPlacement) -> OverlayPortalView<State>
Where the surface sits relative to the child’s bounds (default: below,
centred — see OverlayPlacement::default).
Sourcepub fn band(self, band: OverlayBand) -> OverlayPortalView<State>
pub fn band(self, band: OverlayBand) -> OverlayPortalView<State>
Which z-band the surface paints and hit-tests in (default
OverlayBand::Floating; a tooltip belongs in
OverlayBand::Tooltip).
Sourcepub fn input(self, input: OverlayInput) -> OverlayPortalView<State>
pub fn input(self, input: OverlayInput) -> OverlayPortalView<State>
Whether the surface takes pointer input (default
OverlayInput::Interactive; explanatory chrome the pointer passes
through is OverlayInput::Transparent).
Sourcepub fn outside_tap(self, outside_tap: OutsideTap) -> OverlayPortalView<State>
pub fn outside_tap(self, outside_tap: OutsideTap) -> OverlayPortalView<State>
What a press landing outside every floated surface delivers here
(default OutsideTap::Ignore).
Sourcepub fn on_outside_tap(
self,
callback: impl Fn(&mut State) + 'static,
) -> OverlayPortalView<State>
pub fn on_outside_tap( self, callback: impl Fn(&mut State) + 'static, ) -> OverlayPortalView<State>
Run callback when a press lands outside every floated surface — the
light-dismiss hook.
Setting it also opts the surface into the notification
(OutsideTap::Notify with consume: true, the modal shape) unless an
explicit outside_tap says otherwise, so the tap
that dismisses a menu does not also activate what sits under it. Pass
OutsideTap::Notify { consume: false } for the pass-through shape.
Sourcepub fn preserve_focus(self, preserve: bool) -> OverlayPortalView<State>
pub fn preserve_focus(self, preserve: bool) -> OverlayPortalView<State>
Keep the child’s focus session when the surface claims focus (default
false).
A surface that is about the child rather than a place to type — a
selection toolbar over a field — must not take the field’s focus, or the
selection it acts on disappears the moment it is touched. With this set,
a focus claim from inside the surface is withdrawn again whenever the
child held the focus link, and focus-routed events keep reaching the
child. Left false, a surface that claims focus gets it and the child’s
link inside this portal is dropped, which is what a popover containing
its own text field wants.
Trait Implementations§
Source§impl<State> View<State> for OverlayPortalView<State>where
State: 'static,
impl<State> View<State> for OverlayPortalView<State>where
State: 'static,
Source§type Element = OverlayPortalWidget<State>
type Element = OverlayPortalWidget<State>
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> OverlayPortalWidget<State>
fn build(&self, ctx: &mut BuildCtx<'_>) -> OverlayPortalWidget<State>
Source§fn rebuild(
&self,
prev: &OverlayPortalView<State>,
element: &mut OverlayPortalWidget<State>,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &OverlayPortalView<State>, element: &mut OverlayPortalWidget<State>, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for OverlayPortalView<State>
impl<State> !Send for OverlayPortalView<State>
impl<State> !Sync for OverlayPortalView<State>
impl<State> !UnwindSafe for OverlayPortalView<State>
impl<State> Freeze for OverlayPortalView<State>
impl<State> Unpin for OverlayPortalView<State>
impl<State> UnsafeUnpin for OverlayPortalView<State>where
AnyView<State>: UnsafeUnpin,
Option<AnyView<State>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State)>>: UnsafeUnpin,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.