Struct nctree

Source
#[repr(C)]
pub struct nctree { /* private fields */ }

Implementations§

Source§

impl nctree

§NcTree constructors & destructors

Source

pub fn new<'a>( plane: &mut NcPlane, options: NcTreeOptions, ) -> NcResult<&'a mut Self>

Creates an NcTree with the specified options.

C style function: nctree_create().

Source

pub fn destroy(&mut self)

Destroys an NcTree created with new().

C style function: nctree_destroy().

Source§

impl nctree

§NcTree methods

Source

pub fn add(&mut self, spec: &u32, item: &NcTreeItem) -> NcResult<()>

Inserts item at spec.

The path up to the last element must already exist. If an item already exists at the path, it will be moved to make room for item.

C style function: nctree_add().

Source

pub fn del(&mut self, spec: &u32) -> NcResult<()>

Deletes the item at spec, including any subitems.

C style function: nctree_del().

Source

pub fn focused(&mut self) -> NcResult<&mut NcTreeItem>

Returns the focused item, if any items are present.

This is not a copy; be careful to use it only for the duration of a critical section.

C style function: nctree_focused().

Source

pub fn next(&mut self) -> NcResult<&mut NcTreeItem>

Changes the focus to the next item, and returns it.

C style function: nctree_next().

Source

pub fn prev(&mut self) -> NcResult<&mut NcTreeItem>

Changes the focus to the previous item, and returns it.

C style function: nctree_prev().

Source

pub fn offer_input(&mut self, input: NcInput) -> bool

Offers the input to this NcTree.

If it’s relevant, this function returns true, and the input ought not be processed further. If it’s irrelevant to the tree, false is returned.

Relevant inputs include:

  • a mouse click on an item (focuses item)
  • a mouse scrollwheel event (srolls tree)
  • up, down, pgup, or pgdown (navigates among items)

C style function: nctree_offer_input().

Source

pub fn plane(&mut self) -> NcResult<&NcPlane>

Returns the NcPlane backing this NcTree.

C style function: nctree_plane().

Source

pub fn redraw(&mut self) -> NcResult<()>

Redraws the NcTree in its entirety.

The tree will be cleared, and items will be laid out, using the focused item as a fulcrum.

Item-drawing callbacks will be invoked for each visible item.

C style function: nctree_redraw().

Trait Implementations§

Source§

impl Debug for nctree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for nctree

§

impl RefUnwindSafe for nctree

§

impl Send for nctree

§

impl Sync for nctree

§

impl Unpin for nctree

§

impl UnwindSafe for nctree

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

Source§

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

Source§

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.