Struct TreeNode

Source
pub struct TreeNode<'a, T, L = &'static str> { /* private fields */ }
Expand description

Builder for a tree node widget

Implementations§

Source§

impl<'a, T> TreeNode<'a, T>
where T: AsRef<str>,

Source

pub fn new<I>(id: I, ui: &'a Ui) -> TreeNode<'a, T>
where I: Into<TreeNodeId<T>>,

👎Deprecated since 0.9.0: use ui.tree_node or ui.tree_node_config

Constructs a new tree node builder

Source§

impl<'a, T, L> TreeNode<'a, T, L>
where T: AsRef<str>, L: AsRef<str>,

Source

pub fn label<I, L2>(self, label: L2) -> TreeNode<'a, T, L2>
where I: Into<TreeNodeId<L2>>, L2: AsRef<str>,

Sets the tree node label

Source

pub fn opened(self, opened: bool, cond: Condition) -> TreeNode<'a, T, L>

Sets the opened state of the tree node, which is applied based on the given condition value

Source

pub fn flags(self, flags: TreeNodeFlags) -> TreeNode<'a, T, L>

Replaces all current settings with the given flags.

Source

pub fn selected(self, value: bool) -> TreeNode<'a, T, L>

Enables/disables drawing the tree node in selected state.

Disabled by default.

Source

pub fn framed(self, value: bool) -> TreeNode<'a, T, L>

Enables/disables full-colored frame.

Disabled by default.

Source

pub fn allow_item_overlap(self, value: bool) -> TreeNode<'a, T, L>

Enables/disables allowing the tree node to overlap subsequent widgets.

Disabled by default.

Source

pub fn tree_push_on_open(self, value: bool) -> TreeNode<'a, T, L>

Enables/disables automatic tree push when the tree node is open (= adds extra indentation and pushes to the ID stack).

Enabled by default.

Source

pub fn auto_open_on_log(self, value: bool) -> TreeNode<'a, T, L>

Enables/disables automatic opening of the tree node when logging is active.

By default, logging will automatically open all tree nodes.

Enabled by default.

Source

pub fn default_open(self, value: bool) -> TreeNode<'a, T, L>

Sets the default open state for the tree node.

Tree nodes are closed by default.

Source

pub fn open_on_double_click(self, value: bool) -> TreeNode<'a, T, L>

Only open when the tree node is double-clicked.

Disabled by default.

Source

pub fn open_on_arrow(self, value: bool) -> TreeNode<'a, T, L>

Only open when clicking the arrow part of the tree node.

Disabled by default.

Source

pub fn leaf(self, value: bool) -> TreeNode<'a, T, L>

Enable/disables leaf mode (no collapsing, no arrow).

Disabled by default.

Source

pub fn bullet(self, value: bool) -> TreeNode<'a, T, L>

Display a bullet instead of arrow.

Disabled by default.

Source

pub fn frame_padding(self, value: bool) -> TreeNode<'a, T, L>

Use frame_padding to vertically align text baseline to regular widget height.

Disabled by default.

Source

pub fn nav_left_jumps_back_here(self, value: bool) -> TreeNode<'a, T, L>

Left direction may move to this tree node from any of its child.

Disabled by default.

Source

pub fn push(self) -> Option<TreeNodeToken<'a>>

Pushes a tree node and starts appending to it.

Returns Some(TreeNodeToken) if the tree node is open. After content has been rendered, the token can be popped by calling .pop().

Returns None if the tree node is not open and no content should be rendered.

Source

pub fn build<R, F>(self, f: F) -> Option<R>
where F: FnOnce() -> R,

Creates a tree node and runs a closure to construct the contents. Returns the result of the closure, if it is called.

Note: the closure is not called if the tree node is not open.

Trait Implementations§

Source§

impl<'a, T, L> Clone for TreeNode<'a, T, L>
where T: Clone, L: Clone,

Source§

fn clone(&self) -> TreeNode<'a, T, L>

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<'a, T, L> Debug for TreeNode<'a, T, L>
where T: Debug, L: Debug,

Source§

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

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

impl<'a, T, L> Copy for TreeNode<'a, T, L>
where T: Copy, L: Copy,

Auto Trait Implementations§

§

impl<'a, T, L> Freeze for TreeNode<'a, T, L>
where T: Freeze, L: Freeze,

§

impl<'a, T, L = &'static str> !RefUnwindSafe for TreeNode<'a, T, L>

§

impl<'a, T, L = &'static str> !Send for TreeNode<'a, T, L>

§

impl<'a, T, L = &'static str> !Sync for TreeNode<'a, T, L>

§

impl<'a, T, L> Unpin for TreeNode<'a, T, L>
where T: Unpin, L: Unpin,

§

impl<'a, T, L = &'static str> !UnwindSafe for TreeNode<'a, T, L>

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V