using System; using Ninject; namespace Artemis.Core.LayerBrushes { /// /// A class that describes a layer brush /// public class LayerBrushDescriptor { internal LayerBrushDescriptor(string displayName, string description, string icon, Type layerBrushType, LayerBrushProvider layerBrushProvider) { DisplayName = displayName; Description = description; Icon = icon; LayerBrushType = layerBrushType; LayerBrushProvider = layerBrushProvider; } /// /// The name that is displayed in the UI /// public string DisplayName { get; } /// /// The description that is displayed in the UI /// public string Description { get; } /// /// The Material icon to display in the UI, a full reference can be found /// here /// public string Icon { get; } /// /// The type of the layer brush /// public Type LayerBrushType { get; } /// /// The plugin that provided this /// public LayerBrushProvider LayerBrushProvider { get; } /// /// Gets or sets the kernel used to instantiate the described layer brush /// internal IKernel Kernel { get; set; } /// /// Creates an instance of the described brush and applies it to the layer /// internal void CreateInstance(Layer layer) { if (layer.LayerBrush != null) throw new ArtemisCoreException("Layer already has an instantiated layer brush"); var brush = (BaseLayerBrush) Kernel.Get(LayerBrushType); brush.Layer = layer; brush.Descriptor = this; brush.Initialize(); brush.Update(0); layer.LayerBrush = brush; layer.OnLayerBrushUpdated(); } } }