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
impl Sections
Sourcepub fn new(name: impl Into<String>) -> Self
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.
Sourcepub fn fill(self, fill: bool) -> Self
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]).
Sourcepub fn capitals(self, capitals: bool) -> Self
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.
Sourcepub fn grab_titles(self, grab: bool) -> Self
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.
Sourcepub fn keep_titles(self, keep: bool) -> Self
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.
Sourcepub fn show<'a>(
self,
ui: &mut Ui,
add: impl FnOnce(&mut Stack<'a>),
) -> SectionsResponse
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§
Auto Trait Implementations§
impl Freeze for Sections
impl RefUnwindSafe for Sections
impl Send for Sections
impl Sync for Sections
impl Unpin for Sections
impl UnsafeUnpin for Sections
impl UnwindSafe for Sections
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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