[][src]Struct orbtk_api::widget_base::WidgetContainer

pub struct WidgetContainer<'a> { /* fields omitted */ }

The WidgetContainer wraps the entity of a widget and provides access to its properties, its children properties and its parent properties.

Implementations

impl<'a> WidgetContainer<'a>[src]

pub fn new(
    root: Entity,
    ecm: &'a mut EntityComponentManager<Tree, StringComponentStore>,
    theme: &'a Theme,
    event_queue: Option<&'a Rc<RefCell<EventQueue>>>
) -> Self
[src]

Creates a new widget container for the given entity.

pub fn entity(&self) -> Entity[src]

Gets the entity of the widget.

pub fn clear_dirty(&mut self)[src]

Remove the dirty flag from the current widget.

pub fn get<P>(&self, key: &str) -> &P where
    P: Clone + Component
[src]

Gets the property.

Panics

Panics if the widget does not contains the property.

pub fn get_mut<P>(&mut self, key: &str) -> &mut P where
    P: Clone + Component
[src]

Gets a mutable reference of the property of type P.

Panics

Panics if the widget does not contain the property.

pub fn clone_or_default<P>(&self, key: &str) -> P where
    P: Clone + Component + Default
[src]

Clones the property. If the property does not exists for the widget the default of the property value will be returned,

pub fn clone<P>(&self, key: &str) -> P where
    P: Clone + Component
[src]

Clones the property.

Panics

Panics if the widget does not contains the property.

pub fn try_clone<P>(&self, key: &str) -> Option<P> where
    P: Clone + Component
[src]

Clones the property of type P from the given widget entity. If the entity does not exists or it doesn't have a component of type P None will be returned.

pub fn set<P>(&mut self, key: &str, value: P) where
    P: Component + Clone + PartialEq
[src]

Sets the property of type P. Sets the dirty flag of the widget to true.

Panics

Panics if the widget does not contains the property.

pub fn set_non_dirty<P>(&mut self, key: &str, value: P) where
    P: Component + Clone
[src]

Sets the property of type P without setting the widget dirty.

Panics

Panics if the widget does not contains the property.

pub fn has<P>(&self, key: &str) -> bool where
    P: Clone + Component
[src]

Returns true if the widget has a property of type P otherwise false.

pub fn try_get<P: Component>(&self, key: &str) -> Option<&P>[src]

Returns a reference of a property of type P from the given widget entity. If the entity does not exists or it doesn't have a component of type P None will be returned.

pub fn try_get_mut<P: Component>(&mut self, key: &str) -> Option<&mut P>[src]

Returns a mutable reference of a property of type P from the given widget entity. If the entity does not exists or it doesn't have a component of type P None will be returned.

pub fn eq<P: Component + PartialEq>(&self, key: &str, other: &P) -> bool[src]

Checks if the given value is equal to the given property.

pub fn update(&mut self, force: bool)[src]

Update all properties from theme for the current widget.

pub fn update_dirty(&mut self, force: bool)[src]

Update all properties from theme for the current widget and mark the widget as dirty.

pub fn update_widget(
    &mut self,
    entity: Entity,
    force: bool,
    should_mark_as_dirty: bool
)
[src]

Update all properties from theme for the given widget.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for WidgetContainer<'a>

impl<'a> !Send for WidgetContainer<'a>

impl<'a> !Sync for WidgetContainer<'a>

impl<'a> Unpin for WidgetContainer<'a>

impl<'a> !UnwindSafe for WidgetContainer<'a>

Blanket Implementations

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

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

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

impl<E> Component for E where
    E: Any
[src]

impl<T> From<T> for T[src]

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

impl<T> SetParameter for T

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.