plushie/prop/style_map
StyleMap type for widget style overrides.
Wraps a string-keyed dictionary of PropValues. Builder functions provide a typed API for common style properties while keeping the internal representation wire-ready.
Types
pub type StyleMap {
StyleMap(props: dict.Dict(String, node.PropValue))
}
Constructors
-
StyleMap(props: dict.Dict(String, node.PropValue))
Values
pub fn border(sm: StyleMap, val: node.PropValue) -> StyleMap
Set a border PropValue (use border.to_prop_value to produce it).
pub fn disabled(sm: StyleMap, override: StyleMap) -> StyleMap
Set the disabled state override as a nested StyleMap.
pub fn focused(sm: StyleMap, override: StyleMap) -> StyleMap
Set the focused state override as a nested StyleMap.
pub fn gradient_background(
sm: StyleMap,
g: gradient.Gradient,
) -> StyleMap
Set the background to a gradient.
pub fn hovered(sm: StyleMap, override: StyleMap) -> StyleMap
Set the hovered state override as a nested StyleMap.
pub fn pressed(sm: StyleMap, override: StyleMap) -> StyleMap
Set the pressed state override as a nested StyleMap.
pub fn set(
sm: StyleMap,
key: String,
val: node.PropValue,
) -> StyleMap
Set an arbitrary property on the style map.
pub fn shadow(sm: StyleMap, val: node.PropValue) -> StyleMap
Set a shadow PropValue (use shadow.to_prop_value to produce it).
pub fn to_prop_value(sm: StyleMap) -> node.PropValue
Encode a StyleMap to its wire-format PropValue.