[−][src]Struct native_windows_gui::TreeView
A tree-view control is a window that displays a hierarchical list of items
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.font
: 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
impl TreeView
[src]
pub fn builder<'a>() -> TreeViewBuilder<'a>
[src]
pub fn set_image_list(&self, list: Option<&ImageList>)
[src]
Sets the image list of the treeview
pub fn image_list(&self) -> Option<ImageList>
[src]
Returns the image list of the treeview or None if there is none. The returned image list is not owned
pub fn set_item_image(&self, item: &TreeItem, index: i32, on_select: bool)
[src]
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
pub fn item_image(&self, item: &TreeItem, on_select: bool) -> i32
[src]
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
pub fn set_text_color(&self, r: u8, g: u8, b: u8)
[src]
Sets the text color in the treeview
pub fn text_color(&self) -> [u8; 3]
[src]
Returns the text color in the treeview
pub fn indent(&self) -> u32
[src]
Retrieves the amount, in pixels, that child items are indented relative to their parent items.
pub fn set_indent(&self, indent: u32)
[src]
Sets the width of indentation for a tree-view control and redraws the control to reflect the new width.
pub fn root(&self) -> Option<TreeItem>
[src]
Return the root item of the tree view if one is present.
If there is no root in the tree, returns None
.
pub fn first_child(&self, item: &TreeItem) -> Option<TreeItem>
[src]
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)
pub fn next_sibling(&self, item: &TreeItem) -> Option<TreeItem>
[src]
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
pub fn previous_sibling(&self, item: &TreeItem) -> Option<TreeItem>
[src]
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
pub fn parent(&self, item: &TreeItem) -> Option<TreeItem>
[src]
Returns the parent of the item in the tree or None
if the item is root
pub fn selected_item(&self) -> Option<TreeItem>
[src]
Return the currently selected item.
If there is no selected item, returns None
.
pub fn insert_item<'a>(
&self,
new: &'a str,
parent: Option<&TreeItem>,
position: TreeInsert
) -> TreeItem
[src]
&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
pub fn remove_item(&self, item: &TreeItem)
[src]
Remove an item and its children from the tree view
pub fn select_item(&self, item: &TreeItem)
[src]
Selects the specified tree-view item and scrolls the item into view.
pub fn unselect_item(&self, item: &TreeItem)
[src]
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;
[src]
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;
[src]
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.
pub fn item_text(&self, tree_item: &TreeItem) -> Option<String>
[src]
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
pub fn item_has_children(&self, tree_item: &TreeItem) -> Option<bool>
[src]
Returns true
if the tree view item has children. Returns None
if the item is not in the tree view.
pub fn item_state(&self, tree_item: &TreeItem) -> Option<TreeItemState>
[src]
Returns the item state in the tree view or None
if the item is not in the tree view
pub fn set_expand_state(&self, item: &TreeItem, state: ExpandState)
[src]
Expands or collapses the list of child items associated with the specified parent item, if any.
pub fn ensure_visible(&self, item: &TreeItem)
[src]
Ensures that a tree-view item is visible, expanding the parent item or scrolling the tree-view control, if necessary.
pub fn clear(&self)
[src]
Remove every item from the treeview by removing the root item
pub fn len(&self) -> usize
[src]
Return the total number of item in the tree view
pub fn visible_len(&self) -> usize
[src]
Return the number of item in the tree view visible by the user
pub fn invalidate(&self)
[src]
Invalidate the whole drawing region.
pub fn font(&self) -> Option<Font>
[src]
Return the font of the control
pub fn set_font(&self, font: Option<&Font>)
[src]
Set the font of the control
pub fn focus(&self) -> bool
[src]
Return true if the control currently has the keyboard focus
pub fn set_focus(&self)
[src]
Set the keyboard focus on the button.
pub fn enabled(&self) -> bool
[src]
Return true if the control user can interact with the control, return false otherwise
pub fn set_enabled(&self, v: bool)
[src]
Enable or disable the control
pub fn visible(&self) -> bool
[src]
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))
pub fn set_visible(&self, v: bool)
[src]
Show or hide the control to the user
pub fn size(&self) -> (u32, u32)
[src]
Return the size of the button in the parent window
pub fn set_size(&self, x: u32, y: u32)
[src]
Set the size of the button in the parent window
pub fn position(&self) -> (i32, i32)
[src]
Return the position of the button in the parent window
pub fn set_position(&self, x: i32, y: i32)
[src]
Set the position of the button in the parent window
pub fn class_name(&self) -> &'static str
[src]
Winapi class name used during control creation
pub fn flags(&self) -> u32
[src]
Winapi base flags used during window creation
pub fn forced_flags(&self) -> u32
[src]
Winapi flags required by the control
Trait Implementations
impl Default for TreeView
[src]
impl Drop for TreeView
[src]
impl Eq for TreeView
[src]
impl<'_> From<&'_ TreeView> for ControlHandle
[src]
impl PartialEq<ControlHandle> for TreeView
[src]
fn eq(&self, other: &ControlHandle) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<TreeView> for TreeView
[src]
impl PartialEq<TreeView> for ControlHandle
[src]
impl StructuralEq for TreeView
[src]
impl StructuralPartialEq for TreeView
[src]
Auto Trait Implementations
impl RefUnwindSafe for TreeView
impl !Send for TreeView
impl !Sync for TreeView
impl Unpin for TreeView
impl UnwindSafe for TreeView
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,