Struct egui::memory::Areas

source ·
pub struct Areas {
    areas: IdMap<AreaState>,
    order: Vec<LayerId>,
    visible_last_frame: HashSet<LayerId>,
    visible_current_frame: HashSet<LayerId>,
    wants_to_be_on_top: HashSet<LayerId>,
    sublayers: HashMap<LayerId, HashSet<LayerId>>,
}
Expand description

Keeps track of Areas, which are free-floating Uis. These Areas can be in any Order.

Fields§

§areas: IdMap<AreaState>§order: Vec<LayerId>

Back-to-front. Top is last.

§visible_last_frame: HashSet<LayerId>§visible_current_frame: HashSet<LayerId>§wants_to_be_on_top: HashSet<LayerId>

When an area want to be on top, it is put in here. At the end of the frame, this is used to reorder the layers. This means if several layers want to be on top, they will keep their relative order. So if you close three windows and then reopen them all in one frame, they will all be sent to the top, but keep their previous internal order.

§sublayers: HashMap<LayerId, HashSet<LayerId>>

List of sublayers for each layer

When a layer has sublayers, they are moved directly above it in the ordering.

Implementations§

source§

impl Areas

source

pub(crate) fn count(&self) -> usize

source

pub(crate) fn get(&self, id: Id) -> Option<&AreaState>

source

pub(crate) fn order(&self) -> &[LayerId]

Back-to-front. Top is last.

source

pub(crate) fn order_map(&self) -> HashMap<LayerId, usize>

For each layer, which order is it in Self::order?

source

pub(crate) fn set_state(&mut self, layer_id: LayerId, state: AreaState)

source

pub fn layer_id_at( &self, pos: Pos2, layer_transforms: &HashMap<LayerId, TSTransform> ) -> Option<LayerId>

Top-most layer at the given position.

source

pub fn visible_last_frame(&self, layer_id: &LayerId) -> bool

source

pub fn is_visible(&self, layer_id: &LayerId) -> bool

source

pub fn visible_layer_ids(&self) -> HashSet<LayerId>

source

pub(crate) fn visible_windows( &self ) -> impl Iterator<Item = (LayerId, &AreaState)>

source

pub fn move_to_top(&mut self, layer_id: LayerId)

source

pub fn set_sublayer(&mut self, parent: LayerId, child: LayerId)

Mark the child layer as a sublayer of parent.

Sublayers are moved directly above the parent layer at the end of the frame. This is mainly intended for adding a new Area inside a Window.

This currently only supports one level of nesting. If parent is a sublayer of another layer, the behavior is unspecified.

source

pub fn top_layer_id(&self, order: Order) -> Option<LayerId>

source

pub(crate) fn is_sublayer(&self, layer: &LayerId) -> bool

source

pub(crate) fn end_frame(&mut self)

Trait Implementations§

source§

impl Clone for Areas

source§

fn clone(&self) -> Areas

Returns a copy 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 Areas

source§

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

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

impl Default for Areas

source§

fn default() -> Areas

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Areas

§

impl RefUnwindSafe for Areas

§

impl Send for Areas

§

impl Sync for Areas

§

impl Unpin for Areas

§

impl UnwindSafe for Areas

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> ToOwned for T
where T: Clone,

§

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

§

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

§

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> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,