pub struct WidgetManager<'ui> { /* private fields */ }
Expand description
Handles the entirety of the widget lifecycle.
Implementations§
Source§impl<'ui> WidgetManager<'ui>
impl<'ui> WidgetManager<'ui>
Sourcepub fn new() -> WidgetManager<'ui>
pub fn new() -> WidgetManager<'ui>
Create a new WidgetManager
.
Sourcepub fn try_get_node(&self, widget_id: WidgetId) -> Option<&WidgetNode>
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.
Sourcepub fn get_node(&self, widget_id: &WidgetId) -> &WidgetNode
pub fn get_node(&self, widget_id: &WidgetId) -> &WidgetNode
Sourcepub fn try_get(&self, widget_id: &WidgetId) -> Option<WidgetRef>
pub fn try_get(&self, widget_id: &WidgetId) -> Option<WidgetRef>
Fetch a widget from the tree. Will be None
if it doesn’t exist.
Sourcepub fn try_get_as<W>(&self, widget_id: &WidgetId) -> Option<Rc<W>>where
W: Widget,
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
.
Sourcepub fn get_as<W>(&self, widget_id: &WidgetId) -> Rc<W>where
W: Widget,
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.
Sourcepub fn get_clipping(&self, widget_id: &WidgetId) -> Ref<Shape>
pub fn get_clipping(&self, widget_id: &WidgetId) -> Ref<Shape>
Get the visual clipping Path
for a widget.
Sourcepub const fn get_context(&self) -> &WidgetContext<'ui>
pub const fn get_context(&self) -> &WidgetContext<'ui>
Get the widget build context.
Sourcepub fn add(&mut self, parent_id: Option<WidgetId>, widget: WidgetRef)
pub fn add(&mut self, parent_id: Option<WidgetId>, widget: WidgetRef)
Queues the widget for addition into the tree
Sourcepub fn remove(&mut self, widget_id: WidgetId)
pub fn remove(&mut self, widget_id: WidgetId)
Queues the widget_id
for removal on the next update()
Sourcepub fn update(&mut self, events: &mut Vec<WidgetEvent>)
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.
pub fn print_tree(&self)
pub fn print_tree_modifications(&self)
Trait Implementations§
Source§impl<'ui> Default for WidgetManager<'ui>
impl<'ui> Default for WidgetManager<'ui>
Source§fn default() -> WidgetManager<'ui>
fn default() -> WidgetManager<'ui>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.