ComponentExt

Trait ComponentExt 

Source
pub trait ComponentExt {
Show 16 methods // Required methods fn visible(&self) -> bool; fn height(&self) -> i32; fn width(&self) -> i32; fn set_visible(&self, visible: bool); fn add_class(&self, class: &str); fn classes(&self) -> Vec<String>; fn remove_class(&self, class: &str); fn set_styles(&self, styles: Vec<Style>); fn inner(&self) -> Rc<dyn Any>; fn props(&self) -> &dyn ExtendingProps; fn annotations(&self) -> Ref<'_, Annotations>; fn annotations_mut(&self) -> RefMut<'_, Annotations>; fn try_annotations_mut( &self, ) -> Result<RefMut<'_, Annotations>, BorrowMutError>; fn children(&self) -> Ref<'_, Vec<Component>>; fn children_mut(&self) -> RefMut<'_, Vec<Component>>; fn into_any(self: Rc<Self>) -> Rc<dyn Any>;
}
Expand description

Base trait of all components. Every grx component is a ComponentExt.

Required Methods§

Source

fn visible(&self) -> bool

Whether this component is visible or not.

Source

fn height(&self) -> i32

The actual height of the component

Source

fn width(&self) -> i32

The actual width of the component

Source

fn set_visible(&self, visible: bool)

Set the visibility of this component.

Source

fn add_class(&self, class: &str)

Add a CSS class to this component.

Source

fn classes(&self) -> Vec<String>

Get the list of CSS classes of this component.

Source

fn remove_class(&self, class: &str)

Remove a CSS from this component.

Source

fn set_styles(&self, styles: Vec<Style>)

Set the crate::styles::Styles of this component.

This does not remove styles that are already set but not included in the given vec.

Source

fn inner(&self) -> Rc<dyn Any>

Get the inner component (may be platform specific thing).

Source

fn props(&self) -> &dyn ExtendingProps

Get the props of this component.

Source

fn annotations(&self) -> Ref<'_, Annotations>

Get the annotations of this component.

Source

fn annotations_mut(&self) -> RefMut<'_, Annotations>

Get a mutable ref to the annotations of this component.

Source

fn try_annotations_mut(&self) -> Result<RefMut<'_, Annotations>, BorrowMutError>

Like annotations_mut but with a Result. Errors when the annotations can not be borrowed mutably.

Source

fn children(&self) -> Ref<'_, Vec<Component>>

Get the children of this component.

Source

fn children_mut(&self) -> RefMut<'_, Vec<Component>>

Get a mutable ref to the children of this component.

Source

fn into_any(self: Rc<Self>) -> Rc<dyn Any>

Cast to any.

Trait Implementations§

Source§

impl Debug for dyn ComponentExt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§