Skip to main content

ScreenStack

Struct ScreenStack 

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

Manages a stack of overlay layers with auto z-indexing.

Overlays are rendered in insertion order. Each overlay receives a unique z-index spaced 10 apart from the base. Dim layers are inserted one z-level below overlays that request background dimming.

Implementations§

Source§

impl ScreenStack

Source

pub fn new() -> Self

Creates an empty screen stack with base z-index 1000.

Source

pub fn push( &mut self, config: OverlayConfig, lines: Vec<Vec<Segment>>, ) -> OverlayId

Pushes an overlay onto the stack.

Returns a unique OverlayId for later removal.

Source

pub fn pop(&mut self) -> Option<OverlayId>

Removes the topmost overlay from the stack.

Source

pub fn remove(&mut self, id: OverlayId) -> bool

Removes a specific overlay by ID.

Returns true if the overlay was found and removed.

Source

pub fn clear(&mut self)

Removes all overlays.

Source

pub fn len(&self) -> usize

Returns the number of overlays in the stack.

Source

pub fn is_empty(&self) -> bool

Returns true if the stack has no overlays.

Source

pub fn resolve_position( position: &OverlayPosition, size: Size, screen: Size, ) -> Position

Resolves an overlay position to absolute screen coordinates.

Source

pub fn apply_to_compositor(&self, compositor: &mut Compositor, screen: Size)

Applies all overlays as layers to a compositor.

Each overlay is added with its resolved position and z-index. Overlays with dim_background get a full-screen dim layer inserted one z-level below them.

Trait Implementations§

Source§

impl Default for ScreenStack

Source§

fn default() -> Self

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