[go: up one dir, main page]

Tiles

Struct Tiles 

Source
pub struct Tiles<Pane> { /* private fields */ }
Expand description

Contains all tile state, but no root.

use egui_tiles::{Tiles, TileId, Tree};

struct Pane { } // put some state here

let mut tiles = Tiles::default();
let tabs: Vec<TileId> = vec![tiles.insert_pane(Pane { }), tiles.insert_pane(Pane { })];
let root: TileId = tiles.insert_tab_tile(tabs);

let tree = Tree::new("my_tree", root, tiles);

Implementations§

Source§

impl<Pane> Tiles<Pane>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

The number of tiles, including invisible tiles.

Source

pub fn get(&self, tile_id: TileId) -> Option<&Tile<Pane>>

Source

pub fn get_pane(&self, tile_id: &TileId) -> Option<&Pane>

Get the pane instance for a given TileId

Source

pub fn get_container(&self, tile_id: TileId) -> Option<&Container>

Get the container instance for a given TileId

Source

pub fn get_mut(&mut self, tile_id: TileId) -> Option<&mut Tile<Pane>>

Source

pub fn rect(&self, tile_id: TileId) -> Option<Rect>

Get the screen-space rectangle of where a tile is shown.

This is updated by crate::Tree::ui, so you need to call that first.

If the tile isn’t visible, or is in an inactive tab, this return None.

Source

pub fn iter(&self) -> impl Iterator<Item = (&TileId, &Tile<Pane>)> + '_

All tiles, in arbitrary order

Source

pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&TileId, &mut Tile<Pane>)> + '_

All tiles, in arbitrary order

Source

pub fn tile_ids(&self) -> impl Iterator<Item = TileId> + '_

All TileIds, in arbitrary order

Source

pub fn tiles(&self) -> impl Iterator<Item = &Tile<Pane>> + '_

All Tiles in arbitrary order

Source

pub fn tiles_mut(&mut self) -> impl Iterator<Item = &mut Tile<Pane>> + '_

All Tiles in arbitrary order

Source

pub fn is_visible(&self, tile_id: TileId) -> bool

Tiles are visible by default.

Invisible tiles still retain their place in the tile hierarchy.

Source

pub fn set_visible(&mut self, tile_id: TileId, visible: bool)

Tiles are visible by default.

Invisible tiles still retain their place in the tile hierarchy.

Source

pub fn toggle_visibility(&mut self, tile_id: TileId)

Source

pub fn insert(&mut self, id: TileId, tile: Tile<Pane>)

Source

pub fn remove(&mut self, id: TileId) -> Option<Tile<Pane>>

Remove the tile with the given id from the tiles container.

Note that this does not actually remove the tile from the tree and may leave dangling references. If you want to permanently remove the tile consider calling crate::Tree::remove_recursively.

Source

pub fn next_free_id(&mut self) -> TileId

Source

pub fn insert_new(&mut self, tile: Tile<Pane>) -> TileId

Source

pub fn insert_pane(&mut self, pane: Pane) -> TileId

Source

pub fn insert_container(&mut self, container: impl Into<Container>) -> TileId

Source

pub fn insert_tab_tile(&mut self, children: Vec<TileId>) -> TileId

Source

pub fn insert_horizontal_tile(&mut self, children: Vec<TileId>) -> TileId

Source

pub fn insert_vertical_tile(&mut self, children: Vec<TileId>) -> TileId

Source

pub fn insert_grid_tile(&mut self, children: Vec<TileId>) -> TileId

Source

pub fn parent_of(&self, child_id: TileId) -> Option<TileId>

Source

pub fn is_root(&self, tile_id: TileId) -> bool

Source§

impl<Pane: PartialEq> Tiles<Pane>

Source

pub fn find_pane(&self, needle: &Pane) -> Option<TileId>

Find the tile with the given pane.

Trait Implementations§

Source§

impl<Pane: Clone> Clone for Tiles<Pane>

Source§

fn clone(&self) -> Tiles<Pane>

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<Pane: Debug> Debug for Tiles<Pane>

Source§

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

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

impl<Pane> Default for Tiles<Pane>

Source§

fn default() -> Self

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

impl<'de, Pane> Deserialize<'de> for Tiles<Pane>
where Pane: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Pane: PartialEq> PartialEq for Tiles<Pane>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Pane> Serialize for Tiles<Pane>
where Pane: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<Pane> Freeze for Tiles<Pane>

§

impl<Pane> RefUnwindSafe for Tiles<Pane>
where Pane: RefUnwindSafe,

§

impl<Pane> Send for Tiles<Pane>
where Pane: Send,

§

impl<Pane> Sync for Tiles<Pane>
where Pane: Sync,

§

impl<Pane> Unpin for Tiles<Pane>
where Pane: Unpin,

§

impl<Pane> UnwindSafe for Tiles<Pane>
where Pane: UnwindSafe,

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
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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