Struct native_windows_gui::TreeView [−][src]
pub struct TreeView { pub handle: ControlHandle, }
Expand description
A tree-view control is a window that displays a hierarchical list of items.
While a treeview can support selected multiple item programatically (using select_item
), this is not fully supported
by the winapi implementation.
Requires the tree-view
feature
Builder parameters:
parent
: Required. The tree-view parent container.position
: The treeview position.enabled
: If the treeview can be used by the user. It also has a grayed out look if disabled.focus
: The control receive focus after being createdflags
: A combination of theTreeViewFlags
values.ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapifont
: The font used for the treeview textparent
: The treeview parent container.image_list
: Image list containing the icon to use in the tree-view
Control events:
MousePress(_)
: Generic mouse press events on the tree viewOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel eventOnTreeViewClick
: When the user has clicked the left mouse button within the control.OnTreeViewDoubleClick
: When the user has clicked the left mouse button within the control twice rapidly.OnTreeViewRightClick
: When the user has clicked the right mouse button within the control.OnTreeFocusLost
: When the control has lost the input focusOnTreeFocus
: When the control has acquired the input focusOnTreeItemDelete
: Just before an item is deleted. Also sent for all the children.OnTreeItemExpanded
: After an item was expanded or collapsed. Sends aEventData::OnTreeItemUpdate
.OnTreeItemChanged
: After the state of an item was changed. Sends aEventData::OnTreeItemUpdate
.OnTreeItemSelectionChanged
: After the current selection was changed. Sends aEventData::OnTreeItemChanged
.
Fields
handle: ControlHandle
Implementations
Sets the image list of the treeview
Returns the image list of the treeview or None if there is none. The returned image list is not owned
Sets the image that will appear left to the item text. index
is the index of the image in the image-list
Won’t do anything if the control do not have a image list or if the item is not in the tree
If on_select
is set to true, sets the icon that is used when an item is active
Returns the index of the image in the tree view image list.
If there is no image list in the control or the item is not in the control, 0 will be returned.
If on_select
is set to true, returns the icon that is used when an item is active
Sets the text color in the treeview
Returns the text color in the treeview
Retrieves the amount, in pixels, that child items are indented relative to their parent items.
Sets the width of indentation for a tree-view control and redraws the control to reflect the new width.
Return the root item of the tree view if one is present.
If there is no root in the tree, returns None
.
Returns the first child of an item or None
if the item has no child or if it’s not part of the tree view
To iterate over all the children, use TreeView.iter_item(&parent_item)
Returns the next sibling in the tree or None
if the item has no more sibling or if it’s not part of the tree view
Returns the previous sibling in the tree or None
if the item has no more sibling or if it’s not part of the tree view
Returns the parent of the item in the tree or None
if the item is root
Return the currently selected item. If there are more than one selected item, returns the first one.
If there is no selected item, returns None
.
Returns the selected items in a Treeview
If there is no selected items, returns an empty Vec
.
Returns the number of selected item in the tree view
pub fn insert_item<'a>(
&self,
new: &'a str,
parent: Option<&TreeItem>,
position: TreeInsert
) -> TreeItem
pub fn insert_item<'a>(
&self,
new: &'a str,
parent: Option<&TreeItem>,
position: TreeInsert
) -> TreeItem
Insert a new item into the TreeView and return a reference to new newly added item
Remove an item and its children from the tree view
Selects the specified tree-view item and scrolls the item into view.
Unselects an item from the treeview
pub fn iter<'a>(&'a self) -> TreeViewIterator<'a>ⓘNotable traits for TreeViewIterator<'a>
impl<'a> Iterator for TreeViewIterator<'a> type Item = TreeItem;
pub fn iter<'a>(&'a self) -> TreeViewIterator<'a>ⓘNotable traits for TreeViewIterator<'a>
impl<'a> Iterator for TreeViewIterator<'a> type Item = TreeItem;
Creates an iterator over the tree view items
pub fn iter_item<'a>(&'a self, item: &TreeItem) -> TreeViewIterator<'a>ⓘNotable traits for TreeViewIterator<'a>
impl<'a> Iterator for TreeViewIterator<'a> type Item = TreeItem;
pub fn iter_item<'a>(&'a self, item: &TreeItem) -> TreeViewIterator<'a>ⓘNotable traits for TreeViewIterator<'a>
impl<'a> Iterator for TreeViewIterator<'a> type Item = TreeItem;
Creates an iterator over the children of an item. This does not include the item itself.
Returns the text of the selected item. Return None if the item is not in the tree view. The returned text value cannot be bigger than 260 characters
Returns true
if the tree view item has children. Returns None
if the item is not in the tree view.
Returns the item state in the tree view or None
if the item is not in the tree view
Expands or collapses the list of child items associated with the specified parent item, if any.
Ensures that a tree-view item is visible, expanding the parent item or scrolling the tree-view control, if necessary.
Return the number of item in the tree view visible by the user
Invalidate the whole drawing region.
Return true if the control user can interact with the control, return false otherwise
Enable or disable the control
Return true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))
Show or hide the control to the user
Set the position of the button in the parent window
Winapi class name used during control creation
Winapi flags required by the control
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TreeView
impl UnwindSafe for TreeView