pub struct TreeView { /* private fields */ }Expand description
A list of items that open to show more items: a chooser, a menu of a module, the
structure of a document. Arrows move and open, Enter opens the item, Space checks it
or selects it. With a height, only the visible lines are built.
use ravenrs_reactive::State;
use ravenrs_widgets::{TreeNode, TreeView, Ui};
let selected = State::new(None::<String>);
let tree = TreeView::new(vec![
TreeNode::new("sales", "Sales").child(TreeNode::new("orders", "Orders")),
TreeNode::new("stock", "Stock"),
])
.selected(selected.binding());
let mut ui = Ui::new(tree, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl TreeView
impl TreeView
Sourcepub fn selected(self, selected: Binding<Option<String>>) -> TreeView
pub fn selected(self, selected: Binding<Option<String>>) -> TreeView
The item selected, by key.
Sourcepub fn expanded(self, expanded: Binding<BTreeSet<String>>) -> TreeView
pub fn expanded(self, expanded: Binding<BTreeSet<String>>) -> TreeView
The items open, by key, to keep or to set from outside.
Sourcepub fn checked(self, checked: Binding<BTreeSet<String>>) -> TreeView
pub fn checked(self, checked: Binding<BTreeSet<String>>) -> TreeView
Shows a check box on every line, bound to the keys of the items at the tips. Checking a branch checks everything under it, and a branch partly under check says so.
Sourcepub fn filter(self, text: impl Into<String>) -> TreeView
pub fn filter(self, text: impl Into<String>) -> TreeView
Shows only the items with this text, and the branches that lead to them.
Sourcepub fn on_open(self, handler: impl Fn(&str) + 'static) -> TreeView
pub fn on_open(self, handler: impl Fn(&str) + 'static) -> TreeView
Runs with the key on Enter or on a double click.
Sourcepub fn on_expand(self, handler: impl Fn(&str) + 'static) -> TreeView
pub fn on_expand(self, handler: impl Fn(&str) + 'static) -> TreeView
Runs with the key when an item opens, to bring what is under a TreeNode::lazy one.
Sourcepub fn height(self, height: f32) -> TreeView
pub fn height(self, height: f32) -> TreeView
Scrolls inside this height, building only the lines in sight.
Sourcepub fn row_height(self, height: f32) -> TreeView
pub fn row_height(self, height: f32) -> TreeView
Height of a line in logical pixels. 32 by default.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TreeView
impl !Send for TreeView
impl !Sync for TreeView
impl !UnwindSafe for TreeView
impl Freeze for TreeView
impl Unpin for TreeView
impl UnsafeUnpin for TreeView
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.