SkinDefinition
ReferencesThe editable source of a Skin. Every property of the skin is either set outright, inherited from another property through modifiers, or left unbound and taken from the built-in default. The Lit and Dim skins live in one definition and may inherit from each other; an unbound icon property does so on its own, following its twin in the other mode before it resorts to the built-in default. A definition compiles to a Skin with ToSkin(PropertyId).
Constructors
Properties
BoundProperties
#Default
#The definition behind the built-in skins, read from the Default.ghskin resource. It is the inheritance-aware twin of Skin.DefaultLit and Skin.DefaultDim, and the starting point for new skins. Each call returns a fresh copy.
Indexers
this[]
#Gets the binding of a property, or null if the property is not bound and therefore takes its built-in default.
Parameters:
| id (PropertyId) |
Methods
Bind
#Bind a property. Replaces any existing binding.
Parameters:
| id (PropertyId) | |
| binding (Binding) |
Exceptions:
| ArgumentException | The property does not exist, the binding has the wrong kind, or it would create a cycle. |
CandidateSources
#Gets the properties this property may inherit from: those of the same kind that would not create a cycle.
Parameters:
| id (PropertyId) |
ChainOf
#Gets the chain of sources behind a property, nearest first, ending at a property that is set outright or unbound.
Parameters:
| id (PropertyId) |
Clear
#public void Clear()
DependentsOf
#Gets the properties that directly depend on a property, either by inheriting from it or by mixing it in.
Parameters:
| id (PropertyId) |
Duplicate
#Fallback
#Gets the built-in default value of a property, used when it is not bound.
Parameters:
| id (PropertyId) |
Freeze
#Replace an inherited binding by its current result, as a literal. The property stops following its source.
Parameters:
| id (PropertyId) |
FromSkins
#Gets a fresh copy of the default definition, which expresses the built-in skins as a small number of root colours and the relationships between them.
LoadFromFile
#Resolve
#Parameters:
| id (PropertyId) |
Exceptions:
| InvalidOperationException | The inheritance graph contains a cycle. |
Set
#Set a dash property to alternating dash and gap lengths. An empty pattern, or null, is a solid stroke.
Parameters:
| id (PropertyId) | |
| dash (float[]) |
Set
#Set a filter property to a stack of colour modifiers. An empty stack, or null, is no filter.
Parameters:
| id (PropertyId) | |
| filter (Modifier[]) |
ToSkin
#Compile this definition into a skin for the given mode.
Parameters:
| mode (PropertyId) | Either PropertyId.Lit or PropertyId.Dim. |
Unbind
#Remove the binding of a property, so it takes its built-in default.
Parameters:
| id (PropertyId) |
Returns: True if the property was bound.