TreeView
struct · ferroui-controls · v0.5.0
struct TreeView
Displays a hierarchical tree of data.
Members
TYPEto_refshould_trigger_selectionshould_trigger_selection_keyupdate_selection_from_eventauto_scroll_to_selected_item_propertyselected_item_propertyselected_items_propertyselection_mode_propertyconstructnewselection_changedauto_scroll_to_selected_itemset_auto_scroll_to_selected_itemselection_modeset_selection_modeselected_itemset_selected_itemselected_itemsset_selected_itemsexpand_sub_treecollapse_sub_treeselect_allunselect_allget_realized_tree_containerstree_container_from_itemtree_item_from_containerupdate_selection_from_containerupdate_selection_from_event_sourceget_container_from_event_source
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<TreeView>
Returns a strong reference to this object.
should_trigger_selection
fn should_trigger_selection(self: &Self, selectable: &Visual, event_args: &PointerEventArgs) -> bool
Analyses a pointer event received by a selectable element, and determines whether the action should trigger selection on press, on release, or not at all.
should_trigger_selection_key
fn should_trigger_selection_key(self: &Self, selectable: &Visual, event_args: &KeyEventArgs) -> bool
Analyses a key event received by a selectable element, and determines whether the action should trigger selection.
update_selection_from_event
fn update_selection_from_event(self: &Self, container: &Ref<Control>, event_args: &dyn IRoutedEventArgs) -> bool
Updates the selection based on an event that may have originated in a container that belongs to the control.
Returns true if the event originated from a container that belongs to the control and triggered selection; otherwise false.
auto_scroll_to_selected_item_property
fn auto_scroll_to_selected_item_property() -> &'static StyledProperty<bool>
Defines the AutoScrollToSelectedItem property.
selected_item_property
fn selected_item_property() -> &'static DirectProperty<TreeView, Option<BoxedValue>>
Defines the SelectedItem property.
selected_items_property
fn selected_items_property() -> &'static DirectProperty<TreeView, Option<SelectedItemsList>>
Defines the SelectedItems property.
selection_mode_property
fn selection_mode_property() -> &'static StyledProperty<SelectionMode>
Defines the SelectionMode property.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
selection_changed
fn selection_changed(self: &Self, handler: impl Fn(&Interactive, &SelectionChangedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when the control's selection changes.
auto_scroll_to_selected_item
fn auto_scroll_to_selected_item(self: &Self) -> bool
Gets or sets a value indicating whether to automatically scroll to newly selected items.
This property is of limited use with TreeView as it will only
scroll to realized items. To scroll to a non-expanded item, you need
to ensure that its ancestors are expanded.
set_auto_scroll_to_selected_item
fn set_auto_scroll_to_selected_item(self: &Self, value: bool)
selection_mode
fn selection_mode(self: &Self) -> SelectionMode
Gets or sets the selection mode.
set_selection_mode
fn set_selection_mode(self: &Self, value: SelectionMode)
selected_item
fn selected_item(self: &Self) -> Option<BoxedValue>
Gets or sets the selected item.
Note that setting this property only currently works if the item is expanded to be visible.
set_selected_item
fn set_selected_item(self: &Self, value: Option<BoxedValue>)
selected_items
fn selected_items(self: &Self) -> SelectedItemsList
Gets or sets the selected items.
set_selected_items
fn set_selected_items(self: &Self, value: Option<SelectedItemsList>)
expand_sub_tree
fn expand_sub_tree(self: &Self, item: &TreeViewItem)
Expands the specified TreeViewItem and all its descendent
TreeViewItems.
collapse_sub_tree
fn collapse_sub_tree(self: &Self, item: &TreeViewItem)
Collapses the specified TreeViewItem and all its descendent
TreeViewItems.
select_all
fn select_all(self: &Self)
Selects all items in the TreeView.
Note that this method only selects nodes currently visible due to their parent nodes being expanded: it does not expand nodes.
unselect_all
fn unselect_all(self: &Self)
Deselects all items in the TreeView.
get_realized_tree_containers
fn get_realized_tree_containers(self: &Self) -> Vec<Ref<Control>>
Gets the currently realized containers of the whole tree.
tree_container_from_item
fn tree_container_from_item(self: &Self, item: &Option<BoxedValue>) -> Option<Ref<Control>>
Returns the container of the specified item, searching the whole tree.
tree_item_from_container
fn tree_item_from_container(self: &Self, container: &Ref<Control>) -> Option<BoxedValue>
Returns the item of the specified container, searching the whole tree.
update_selection_from_container
fn update_selection_from_container(self: &Self, container: &Ref<Control>, select: bool, range_modifier: bool, toggle_modifier: bool, right_button: bool)
Updates the selection for an item based on user interaction.
select is whether the item should be selected or unselected,
range_modifier whether the range modifier is enabled (i.e. the
shift key), toggle_modifier whether the toggle modifier is enabled
(i.e. the control key) and right_button whether the event is a
right-click.
update_selection_from_event_source
fn update_selection_from_event_source(self: &Self, event_source: Option<Ref<FerroObject>>, select: bool, range_modifier: bool, toggle_modifier: bool, right_button: bool) -> bool
Updates the selection based on an event that may have originated in a container that belongs to the control.
event_source is the control that raised the event; the other
arguments are those of
update_selection_from_container.
Returns true if the event originated from a container that belongs to the control; otherwise false.
get_container_from_event_source
fn get_container_from_event_source(self: &Self, event_source: Option<Ref<FerroObject>>) -> Option<Ref<TreeViewItem>>
Tries to get the container that was the source of an event.
Returns the container or None if the event did not originate in a
container.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtControlImplExtItemsControlImplExtTreeViewImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<TreeView>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleStyledElementImplVisualImplLayoutableImplInteractiveImplTemplatedControlImplControlImplFerroObjectImplInputElementImplItemsControlImplTreeViewImplICustomKeyboardNavigation
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.