Skip to main content

OverlayStack

Struct OverlayStack 

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

The stack, bottom first.

Implementations§

Source§

impl OverlayStack

Source

pub fn new() -> Self

Source

pub fn open( &mut self, spec: OverlaySpec, focused: Option<Id>, ) -> (Opened, Vec<Closed>)

Opens an overlay on top, remembering the focus to restore.

Source

pub fn update(&mut self, spec: OverlaySpec) -> bool

Replaces an open overlay’s declaration where it is (its Escape rule, its offset), closing nothing; whether it is open.

Source

pub fn close(&mut self, id: Id) -> Vec<Closed>

Closes an overlay and everything above it. Closing one that is not open closes nothing (the list is empty).

Source

pub fn escape(&mut self) -> Vec<Closed>

Escape: closes the top overlay if it allows it.

Source

pub fn click(&mut self, hit: Option<Id>) -> Vec<Closed>

A click on hit (an overlay, or None for the interface below): closes the dismissable overlays above it, stopping at a modal or at one that stays.

Source

pub fn modal(&self) -> Option<Id>

The topmost modal, if any: everything below it is blocked.

Source

pub fn is_blocked(&self, target: Option<Id>) -> bool

Whether input to an overlay (or to the interface, None) is blocked by a modal above it.

Source

pub fn top(&self) -> Option<&OverlaySpec>

Source

pub fn contains(&self, id: Id) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn specs(&self) -> impl Iterator<Item = &OverlaySpec>

The overlays, bottom first.

Source

pub fn set_rect(&mut self, id: Id, rect: Rect)

Records where an overlay was drawn (for outside clicks).

Source

pub fn set_anchor(&mut self, id: Id, anchor: Rect)

Records the widget an overlay was placed next to: a press there is not outside it.

Source

pub fn set_popups(&mut self, id: Id, layers: Vec<LayerId>)

Records the egui layers drawn from inside an overlay (a combo box’s list, a context menu): a press on one of them is not outside it, and while one of them is open Escape goes to it.

Source

pub fn top_popups(&self) -> &[LayerId]

The egui layers drawn from inside the top overlay last pass.

Source

pub fn hit(&self, pos: Pos2) -> Option<Id>

The topmost overlay drawn, or anchored, at a point: a press on the widget that opened an overlay leaves that overlay to it (its click toggles it), instead of closing it on the press and the click opening it again.

Source

pub fn hit_on(&self, pos: Pos2, layer: Option<LayerId>) -> Option<Id>

As Self::hit, layer being the egui layer at the point: a press on a popup an overlay opened is inside that overlay.

Trait Implementations§

Source§

impl Clone for OverlayStack

Source§

fn clone(&self) -> OverlayStack

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OverlayStack

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for OverlayStack

Source§

fn default() -> OverlayStack

Returns the “default value” for a type. 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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

§

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

§

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

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,