Struct WidgetManager

Source
pub struct WidgetManager<'ui> { /* private fields */ }
Expand description

Handles the entirety of the widget lifecycle.

Implementations§

Source§

impl<'ui> WidgetManager<'ui>

Source

pub fn new() -> WidgetManager<'ui>

Create a new WidgetManager.

Source

pub fn get_tree(&self) -> &Tree<WidgetId>

Returns the widget tree.

Source

pub fn contains(&self, widget_id: &WidgetId) -> bool

Check if a widget exists in the tree.

Source

pub fn try_get_node(&self, widget_id: WidgetId) -> Option<&WidgetNode>

Fetch the tree representation of a widget. Will be None if it doesn’t exist.

Source

pub fn get_node(&self, widget_id: &WidgetId) -> &WidgetNode

Fetch the tree representation of a widget.

§Panics

Will panic if the widget is not found.

Source

pub fn try_get(&self, widget_id: &WidgetId) -> Option<WidgetRef>

Fetch a widget from the tree. Will be None if it doesn’t exist.

Source

pub fn get(&self, widget_id: &WidgetId) -> WidgetRef

Fetch a widget from the tree.

§Panics

This will panic if the widget is not found.

Source

pub fn try_get_as<W>(&self, widget_id: &WidgetId) -> Option<Rc<W>>
where W: Widget,

Fetch a widget as the specified type. If it doesn’t exist, or it is not the requested type, this will return None.

Source

pub fn get_as<W>(&self, widget_id: &WidgetId) -> Rc<W>
where W: Widget,

Fetch a widget as the specified type.

§Panics

If the widget is not the requested type, it will panic.

Source

pub fn get_rect(&self, widget_id: &WidgetId) -> Option<&Rect>

Get the visual Rect of a widget.

Source

pub fn get_clipping(&self, widget_id: &WidgetId) -> Ref<Shape>

Get the visual clipping Path for a widget.

Source

pub const fn get_context(&self) -> &WidgetContext<'ui>

Get the widget build context.

Source

pub fn add(&mut self, parent_id: Option<WidgetId>, widget: WidgetRef)

Queues the widget for addition into the tree

Source

pub fn remove(&mut self, widget_id: WidgetId)

Queues the widget_id for removal on the next update()

Source

pub fn update(&mut self, events: &mut Vec<WidgetEvent>)

Update the UI tree.

This processes any pending additions, removals, and updates. The events parameter is a list of all changes that occured during the process, in order.

Source

pub fn print_tree(&self)

Source

pub fn print_tree_modifications(&self)

Trait Implementations§

Source§

impl<'ui> Default for WidgetManager<'ui>

Source§

fn default() -> WidgetManager<'ui>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'ui> !Freeze for WidgetManager<'ui>

§

impl<'ui> !RefUnwindSafe for WidgetManager<'ui>

§

impl<'ui> !Send for WidgetManager<'ui>

§

impl<'ui> !Sync for WidgetManager<'ui>

§

impl<'ui> Unpin for WidgetManager<'ui>

§

impl<'ui> !UnwindSafe for WidgetManager<'ui>

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V