SkinDefinition

References
public sealed class SkinDefinition : IStorable
The 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

SkinDefinition

#
public SkinDefinition()

SkinDefinition

#
Deserialisation constructor. The text form is the stored form.
public SkinDefinition(
reader
)

Properties

Author

#
Who made this skin. Stored in the file header; empty when unknown.
public string Author { get; set; }

BoundProperties

#
public PropertyId[] BoundProperties { get; }

Count

#
public int Count { get; }

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.
public static SkinDefinition Default { get; }

Description

#
What this skin is about, possibly several lines. Stored in the file header, one line per header entry; empty when there is none.
public string Description { get; set; }

Indexers

this[]

#
Gets the binding of a property, or null if the property is not bound and therefore takes its built-in default.
public Binding this[] { get; }

Methods

Bind

#
Bind a property. Replaces any existing binding.
public void Bind(
id,
binding
)
ArgumentExceptionThe 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.
public PropertyId[] CandidateSources()

ChainOf

#
Gets the chain of sources behind a property, nearest first, ending at a property that is set outright or unbound.
public PropertyId[] ChainOf()

Clear

#
public void Clear()

DependentsOf

#
Gets the properties that directly depend on a property, either by inheriting from it or by mixing it in.
public PropertyId[] DependentsOf()

Duplicate

#
public SkinDefinition Duplicate()

Evaluate

#
public Dictionary<PropertyId, SkinValue> Evaluate()

Fallback

#
Gets the built-in default value of a property, used when it is not bound.
public static SkinValue Fallback()

Freeze

#
Replace an inherited binding by its current result, as a literal. The property stops following its source.
public void Freeze()

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.
public static SkinDefinition FromSkins(
lit,
dim
)

Inherit

#
public void Inherit(
id,
source,
params Modifier[]
modifiers
)

LoadFromFile

#
public static SkinDefinition LoadFromFile(
path,
out string[]
errors
)

Parse

#
Read a definition from its text form. Faulty lines are skipped and reported.
public static SkinDefinition Parse(
text,
Definition text.
out string[]
errors
One message per faulty line.
)

Resolve

#
public SkinValue Resolve()
InvalidOperationExceptionThe inheritance graph contains a cycle.

SaveToFile

#
public void SaveToFile(
path
)

Set

#
public void Set(
id,
Color
colour
)

Set

#
public void Set(
id,
colour
)

Set

#
public void Set(
id,
length
)

Set

#
Set a dash property to alternating dash and gap lengths. An empty pattern, or null, is a solid stroke.
public void Set(
id,
dash
)

Set

#
Set a filter property to a stack of colour modifiers. An empty stack, or null, is no filter.
public void Set(
id,
filter
)

Store

#
public void Store(
writer
)
Store

ToSkin

#
Compile this definition into a skin for the given mode.
public Skin ToSkin()

ToText

#
public string ToText()

Unbind

#
Remove the binding of a property, so it takes its built-in default.
public bool Unbind()
True if the property was bound.

WouldCycle

#
public bool WouldCycle(
id,
binding
)