pub struct TreeRow { /* private fields */ }Expand description
A row of a hand-built tree: a branch’s toggle, or a leaf’s room for
one, then the row the caller draws; TreeRowResponse::body shows
the rows below a branch, indented, when it is open. Its open state is
kept under the id it is given (see the module).
Need (data): a row of a hand-built tree with its disclosure toggle (a folder tree in a side panel).
Implementations§
Source§impl TreeRow
impl TreeRow
Sourcepub fn new(id: Id, name: impl Into<String>) -> Self
pub fn new(id: Id, name: impl Into<String>) -> Self
A branch kept under id (ui.make_persistent_id(..), the id
egui’s CollapsingState would be given), its toggle named after
name (its row’s text, as read aloud). Folded until opened,
unless TreeRow::default_open.
Sourcepub fn depth(self, depth: usize) -> Self
pub fn depth(self, depth: usize) -> Self
A row of a flat tree drawn at depth (0 at the top): indented by
depth times the theme’s spacing.indent before its toggle (or a
leaf’s room for one), and said to be at level depth + 1 to
assistive technology (its toggle and its row both carry the
level). For a tree kept as a flat list, whose rows are not nested
in their parents’ TreeRowResponse::body (a folder list that
leaves out the folders between): what the caller draws in the row
(a selectable label, a drag source) is unchanged. Without it, a
row is indented only by the bodies it is shown in, and says no
level.
Sourcepub fn toggle_name(self, name: impl Into<String>) -> Self
pub fn toggle_name(self, name: impl Into<String>) -> Self
The toggle’s whole accessible name, in place of “Show or hide” and the row’s name (“Show or hide the albums of Travel”).
Sourcepub fn default_open(self, open: bool) -> Self
pub fn default_open(self, open: bool) -> Self
Whether a branch is open the first time it is shown (no by default).
Sourcepub fn show<R>(
self,
ui: &mut Ui,
add: impl FnOnce(&mut Ui) -> R,
) -> TreeRowResponse<R>
pub fn show<R>( self, ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R, ) -> TreeRowResponse<R>
Shows the toggle and the row add gives, in one horizontal line.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeRow
impl RefUnwindSafe for TreeRow
impl Send for TreeRow
impl Sync for TreeRow
impl Unpin for TreeRow
impl UnsafeUnpin for TreeRow
impl UnwindSafe for TreeRow
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