[][src]Struct gui::Ui

pub struct Ui<E> where
    E: 'static + Debug
{ /* fields omitted */ }

A Ui is a container for related widgets.

Methods

impl<E> Ui<E> where
    E: 'static + Debug
[src]

pub fn new(
    new_root_widget: &'f mut dyn FnMut(Id, &mut dyn MutCap<E>) -> Box<dyn Widget<E>>
) -> (Self, Id)
[src]

Create a new Ui instance containing one widget that acts as the root widget.

pub fn render(&self, renderer: &dyn Renderer)[src]

Render the Ui with the given Renderer.

pub fn handle<T>(&mut self, event: T) -> Option<UnhandledEvents<E>> where
    T: Into<UiEvent<E>>, 
[src]

Handle an event.

This function performs the initial determination of which widget is supposed to handle the given event and then passes it down to the actual event handler.

Trait Implementations

impl<E> Cap for Ui<E> where
    E: 'static + Debug
[src]

fn children(&self, widget: Id) -> Iter<'widget, Id>[src]

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

fn root_id(&self) -> Id[src]

Retrieve the Id of the root widget.

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

Retrieve the parent of the given widget.

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

Check whether a widget has its visibility flag set.

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

Check whether a widget is actually being displayed.

fn focused(&self) -> Option<Id>[src]

Retrieve the currently focused widget.

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

Check whether the given widget is focused.

impl<E> MutCap<E> for Ui<E> where
    E: 'static + Debug
[src]

fn add_widget(
    &mut self,
    parent: Id,
    new_widget: &'f mut dyn FnMut(Id, &mut dyn MutCap<E>) -> Box<dyn Widget<E>>
) -> Id
[src]

Add a widget to the Ui.

fn show(&mut self, widget: Id)[src]

Show a widget, i.e., set its and its parents' visibility flag.

fn hide(&mut self, widget: Id)[src]

Hide a widget, i.e., unset its visibility flag.

fn focus(&mut self, widget: Id)[src]

Focus a widget.

fn hook_events(
    &mut self,
    widget: Id,
    hook_fn: Option<&'static dyn Fn(&mut dyn Widget<E>, &E, &dyn Cap) -> Option<UiEvents<E>>>
) -> Option<&'static dyn Fn(&mut dyn Widget<E>, &E, &dyn Cap) -> Option<UiEvents<E>>>
[src]

Install or remove an event hook handler.

impl<E: Default> Default for Ui<E> where
    E: 'static + Debug
[src]

impl<E: Debug> Debug for Ui<E> where
    E: 'static + Debug
[src]

Auto Trait Implementations

impl<E> !Send for Ui<E>

impl<E> !Sync for Ui<E>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.