Trait gui::Cap

source ·
pub trait Cap: Debug + Sealed {
    // Required methods
    fn data(&self, widget: Id) -> &dyn Any;
    fn children(&self, widget: Id) -> Iter<'_, Id> ;
    fn root_id(&self) -> Id;
    fn parent_id(&self, widget: Id) -> Option<Id>;
    fn is_visible(&self, widget: Id) -> bool;
    fn is_displayed(&self, widget: Id) -> bool;
    fn focused(&self) -> Option<Id>;
    fn is_focused(&self, widget: Id) -> bool;
}
Expand description

A capability allowing for various widget related operations.

Required Methods§

source

fn data(&self, widget: Id) -> &dyn Any

Retrieve a reference to a widget’s data.

source

fn children(&self, widget: Id) -> Iter<'_, Id>

Retrieve an iterator over the children. Iteration happens in z-order, from highest to lowest.

source

fn root_id(&self) -> Id

Retrieve the Id of the root widget.

source

fn parent_id(&self, widget: Id) -> Option<Id>

Retrieve the parent of the given widget.

source

fn is_visible(&self, widget: Id) -> bool

Check whether a widget has its visibility flag set.

Note that a return value of true does not necessary mean that the widget is actually visible. A widget is only visible if all its parents have the visibility flag set, too. The is_displayed method can be used to check for actual visibility.

source

fn is_displayed(&self, widget: Id) -> bool

Check whether a widget is actually being displayed.

This method checks whether the referenced widget is actually being displayed, that is, whether its own as well as its parents’ visibility flags are all set.

source

fn focused(&self) -> Option<Id>

Retrieve the currently focused widget.

source

fn is_focused(&self, widget: Id) -> bool

Check whether the widget with the given Id is focused.

Implementors§

source§

impl<E, M> Cap for Ui<E, M>