Skip to main content

Sections

Struct Sections 

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

A stack of collapsible sections filling the room it is given (a panel’s height), named for its memory and for agents.

Need (layout): collapsible sections in a panel.

Implementations§

Source§

impl Sections

Source

pub fn new(name: impl Into<String>) -> Self

A stack named name, unique in the application: its layout is remembered under it and laid_out reads it.

Source

pub fn fill(self, fill: bool) -> Self

Whether the stack fills the room it is given (yes by default): the last open section takes what the others leave, and the bands of folded sections below it sit at the bottom. Off, it is sized by its content: an open section sized by the list is never taller than what its body lays out, the long ones share what is left, the folded bands follow right under the last open section, and the room left stays empty under the last band. A section set by hand keeps its height, the last open one too: a drag down grows the section above past its content, into that room, and a drag up shrinks it to its least height; the content only places the sections until a drag ([egui_stack::sections::Sections::fill]).

Source

pub fn capitals(self, capitals: bool) -> Self

Whether titles are drawn in capitals (yes by default, as a code editor’s side bar does); their accessible names keep their case.

Source

pub fn grab_titles(self, grab: bool) -> Self

Whether a title drags as well as folds (no by default, as the line above a band is what classic apps resize by, and a code editor’s headers reorder when dragged).

A press that moves is a drag, by the same rules as a boundary’s, the title staying under the pointer; one that does not is a fold. A title under a folded section resizes the first open one above, and with nothing open above it does not move. A double click drops the heights set by hand; as its first click has already folded, the section is seen folded until the second. A band keeps its name and its role.

Source

pub fn keep_titles(self, keep: bool) -> Self

Whether a title stays where it is when its section folds or opens (no by default, as a code editor’s panes divide the room again, and the title moves).

Folding, the open sections above keep their shown height, as if set by hand; those below move up, and with nothing below the room stays empty. Opening, the section takes its room below its title, from the sections below, then from the empty room. In a panel with no room for it, those above still give way, and the title moves. A double click gets the shares back.

Source

pub fn show<'a>( self, ui: &mut Ui, add: impl FnOnce(&mut Stack<'a>), ) -> SectionsResponse

Lays the sections add gives out in the room left in ui.

Trait Implementations§

Source§

impl Clone for Sections

Source§

fn clone(&self) -> Sections

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 Sections

Source§

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

Formats the value using the given formatter. 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,