Struct egui::memory::Areas

source ·
pub struct Areas {
    areas: IdMap<AreaState>,
    visible_areas_last_frame: HashSet<LayerId>,
    visible_areas_current_frame: HashSet<LayerId>,
    order: Vec<LayerId>,
    order_map: HashMap<LayerId, usize>,
    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>§visible_areas_last_frame: HashSet<LayerId>§visible_areas_current_frame: HashSet<LayerId>§order: Vec<LayerId>

Back-to-front, top is last.

§order_map: HashMap<LayerId, usize>

Inverse of Self::order, calculated at the end of the frame.

§wants_to_be_on_top: HashSet<LayerId>

When an area wants to be on top, it is assigned here. This is used to reorder the layers at the end of the frame. If several layers want to be on top, they will keep their relative order. This means closing three windows and then reopening them all in one frame results in them being sent to the top and keeping their previous internal order.

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

The sublayers that each layer has.

The parent sublayer is moved directly above the child sublayers 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]

All layers back-to-front, top is last.

source

pub(crate) fn compare_order(&self, a: LayerId, b: LayerId) -> Ordering

Compare the order of two layers, based on the order list from last frame.

May return std::cmp::Ordering::Equal if the layers are not in the order list.

source

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

source

pub fn layer_id_at( &self, pos: Pos2, layer_to_global: &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.

The two layers must have the same LayerId::order.

source

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

source

pub fn parent_layer(&self, layer_id: LayerId) -> Option<LayerId>

If this layer is the sublayer of another layer, return the parent.

source

pub fn child_layers( &self, layer_id: LayerId, ) -> impl Iterator<Item = LayerId> + '_

All the child layers of this layer.

source

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

source

pub(crate) fn end_pass(&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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

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

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