StyleBase
struct · ferroui-base · v0.5.0
struct StyleBase
Base class for Style, ControlTheme
and ContainerQuery.
Members
TYPEto_refset_parentto_display_stringconstructchildrenownerowner_changedparentresourcesset_resourcessettersadd_setterclear_settersaddanimationsadd_animationclear_animationsadd_childadd_styletry_get_resourceadd_ownerremove_owner
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<StyleBase>
Returns a strong reference to this object.
set_parent
fn set_parent(self: &Self, parent: Option<&Ref<StyleBase>>)
Sets the parent style. Called when the style is added to or
removed from the children of another style; validates that the
style can be nested in parent.
to_display_string
fn to_display_string(self: &Self) -> String
A string describing the style: its selector, target type or query.
construct
fn construct() -> Self
Creates the class data; see FerroObject::construct.
children
fn children(self: &Self) -> StyleChildren
The children of the style.
owner
fn owner(self: &Self) -> Option<ResourceHostRef>
The owner of the style: the resource host whose styles collection the style, or an ancestor of it, was added to.
owner_changed
fn owner_changed(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
Raised when the owner of the style changes.
parent
fn parent(self: &Self) -> Option<Ref<StyleBase>>
The parent style, if the style is a nested style.
resources
fn resources(self: &Self) -> Ref<ResourceDictionary>
The dictionary of style resources.
set_resources
fn set_resources(self: &Self, value: Ref<ResourceDictionary>)
setters
fn setters(self: &Self) -> FerroList<Rc<dyn SetterBase>>
The style's setters. The list is returned by handle: clones refer to the same list.
add_setter
fn add_setter(self: &Self, setter: Rc<dyn SetterBase>)
Adds a setter to the style.
clear_setters
fn clear_setters(self: &Self)
Removes all setters from the style.
add
fn add(self: &Self, setter: Rc<dyn SetterBase>)
Adds a setter to the style.
animations
fn animations(self: &Self) -> FerroList<Rc<dyn IAnimation>>
The style's animations. The list is returned by handle: clones refer to the same list.
add_animation
fn add_animation(self: &Self, animation: impl Into<Rc<dyn IAnimation>>)
Adds an animation to the style: it runs on every control the style applies to, while the style is active.
clear_animations
fn clear_animations(self: &Self)
Removes all animations from the style.
add_child
fn add_child(self: &Self, child: &BoxedValue)
Adds an untyped child: a setter is added to the setters, a style to the child styles. Panics for anything else.
add_style
fn add_style(self: &Self, style: impl Into<Rc<dyn IStyle>>)
Adds a child style.
try_get_resource
fn try_get_resource(self: &Self, key: &ResourceKey, theme_variant: Option<&ThemeVariant>) -> Option<ResourceValue>
Tries to find a resource in the style's resources and then in its child styles.
add_owner
fn add_owner(self: &Self, owner: &ResourceHostRef)
Adds an owner to the style.
remove_owner
fn remove_owner(self: &Self, owner: &ResourceHostRef)
Removes the owner of the style.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeStyleBaseImplExtFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<StyleBase>StaticTypeObjectTypeSubclassable<T>FerroObjectImplStyleBaseImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.