#[repr(C)]pub struct DynamicCssProperty {
pub dynamic_id: AzString,
pub default_value: CssProperty,
}Expand description
A DynamicCssProperty is a type of css property that can be changed on possibly
every frame by the Rust code - for example to implement an On::Hover behaviour.
The syntax for such a property looks like this:
#my_div {
padding: var(--my_dynamic_property_id, 400px);
}Azul will register a dynamic property with the key “my_dynamic_property_id” and the default value of 400px. If the property gets overridden during one frame, the overridden property takes precedence.
At runtime the style is immutable (which is a performance optimization - if we
can assume that the property never changes at runtime), we can do some optimizations on it.
Dynamic style properties can also be used for animations and conditional styles
(i.e. hover, focus, etc.), thereby leading to cleaner code, since all of these
special cases now use one single API.
Fields§
§dynamic_id: AzStringThe stringified ID of this property, i.e. the "my_id" in width: var(--my_id, 500px).
default_value: CssPropertyDefault values for this properties - one single value can control multiple properties!
Implementations§
Source§impl DynamicCssProperty
impl DynamicCssProperty
pub fn is_inheritable(&self) -> bool
pub fn can_trigger_relayout(&self) -> bool
Trait Implementations§
Source§impl Clone for DynamicCssProperty
impl Clone for DynamicCssProperty
Source§fn clone(&self) -> DynamicCssProperty
fn clone(&self) -> DynamicCssProperty
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more