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§
Sourcefn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Set the visibility of this component.
Sourcefn remove_class(&self, class: &str)
fn remove_class(&self, class: &str)
Remove a CSS from this component.
Sourcefn set_styles(&self, styles: Vec<Style>)
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.
Sourcefn props(&self) -> &dyn ExtendingProps
fn props(&self) -> &dyn ExtendingProps
Get the props of this component.
Sourcefn annotations(&self) -> Ref<'_, Annotations>
fn annotations(&self) -> Ref<'_, Annotations>
Get the annotations of this component.
Sourcefn annotations_mut(&self) -> RefMut<'_, Annotations>
fn annotations_mut(&self) -> RefMut<'_, Annotations>
Get a mutable ref to the annotations of this component.
Sourcefn try_annotations_mut(&self) -> Result<RefMut<'_, Annotations>, BorrowMutError>
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.
Sourcefn children_mut(&self) -> RefMut<'_, Vec<Component>>
fn children_mut(&self) -> RefMut<'_, Vec<Component>>
Get a mutable ref to the children of this component.