Skip to main content

OverlayPortalController

Struct OverlayPortalController 

Source
pub struct OverlayPortalController { /* private fields */ }
Expand description

A class to show, hide and bring to top an OverlayPortal’s overlay child in the target Overlay.

An OverlayPortalController can only be given to at most one OverlayPortal at a time. When an OverlayPortalController is moved from one OverlayPortal to another, its is_showing state does not carry over.

show and hide can be called even before the controller is assigned to any OverlayPortal, but they typically should not be called while the widget tree is being rebuilt.

Implementations§

Source§

impl OverlayPortalController

Source

pub fn new( app: &mut App, debug_label: Option<String>, ) -> Ref<OverlayPortalController>

Creates an OverlayPortalController, optionally with a debug_label.

Source

pub fn show(self: Handle<Self>, app: &mut App)

Show the overlay child of the OverlayPortal this controller is attached to, at the top of the target Overlay.

When there is more than one OverlayPortal that targets the same Overlay, the overlay child of the last OverlayPortal to have called show appears at the top level, unobstructed.

If is_showing is already true, calling this method brings the overlay child it controls to the top.

This method should typically not be called while the widget tree is being rebuilt.

Source

pub fn hide(self: Handle<Self>, app: &mut App)

Hide the OverlayPortal’s overlay child.

Once hidden, the overlay child will be removed from the widget tree the next time the widget tree rebuilds, and stateful widgets in the overlay child may lose state as a result.

This method should typically not be called while the widget tree is being rebuilt.

Source

pub fn is_showing(self: Handle<Self>, app: &App) -> bool

Whether the associated OverlayPortal should build and show its overlay child, using its overlay_child_builder.

Source

pub fn toggle(self: Handle<Self>, app: &mut App)

Convenience method for toggling the current is_showing status.

This method should typically not be called while the widget tree is being rebuilt.

Trait Implementations§

Source§

impl Debug for OverlayPortalController

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,