Struct winsafe::gui::spec::TreeViewItem

source ·
pub struct TreeViewItem<'a, T: 'static = ()> { /* private fields */ }
Available on crate feature gui only.
Expand description

A single item of a TreeView control.

Each object keeps an unique HTREEITEM handle.

You cannot directly instantiate this object, it is created internally by the control.

Implementations§

source§

impl<'a, T> TreeViewItem<'a, T>

source

pub fn add_child(&self, text: &str, icon_index: Option<u32>, data: T) -> Self

Adds a new child item by sending a tvm::InsertItem message, and returns the newly added item.

source

pub fn data(&self) -> Option<Rc<RefCell<T>>>

Returns a Rc/RefCell with the stored data by sending an lvm::GetItem message.

Returns None if the ListView holds a (), or if the item holds an invalid index.

source

pub fn delete(&self)

Deletes the item by sending a tvm::DeleteItem message.

source

pub fn edit_label(&self) -> HWND

Begins in-place editing of the item’s text by sending a tvm::EditLabel message.

Returns a handle to the edit control.

source

pub fn ensure_visible(&self) -> bool

Ensures that a tree-view item is visible, expanding the parent item or scrolling the tree-view control, if necessary, by sending a tvm::EnsureVisible message.

Returns whether a scroll occurred and no items were expanded.

source

pub fn expand(&self, expand: bool)

Expands or collapse the item by sending a tvm::Expand message.

source

pub const fn htreeitem(&self) -> &HTREEITEM

Returns the underlying handle of the item.

source

pub fn is_expanded(&self) -> bool

Tells if the item is expanded by sending a tvm::GetItemState message.

source

pub fn is_root(&self) -> bool

Tells if the item is a root by sending a tvm::GetNextItem message.

source

pub fn iter_children(&self) -> impl Iterator<Item = TreeViewItem<'a, T>> + 'a

Returns an iterator over the child items.

source

pub fn iter_next_siblings( &self ) -> impl Iterator<Item = TreeViewItem<'a, T>> + 'a

Returns an iterator over the next sibling items.

source

pub fn iter_prev_siblings( &self ) -> impl Iterator<Item = TreeViewItem<'a, T>> + 'a

Returns an iterator over the previous sibling items.

source

pub fn parent(&self) -> Option<Self>

Retrieves the parent of the item by sending a tvm::GetNextItem message.

source

pub fn set_text(&self, text: &str)

Sets the text of the item by sending a tvm::SetItem message.

source

pub fn text(&self) -> String

Retrieves the text of the item by sending a tvm::GetItem message.

Auto Trait Implementations§

§

impl<'a, T> Freeze for TreeViewItem<'a, T>

§

impl<'a, T = ()> !RefUnwindSafe for TreeViewItem<'a, T>

§

impl<'a, T = ()> !Send for TreeViewItem<'a, T>

§

impl<'a, T = ()> !Sync for TreeViewItem<'a, T>

§

impl<'a, T> Unpin for TreeViewItem<'a, T>

§

impl<'a, T = ()> !UnwindSafe for TreeViewItem<'a, T>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.