using System; namespace DevComponents.DotNetBar.SuperGrid.Style { /// /// Represents base class that each visual style factory for SuperGridControl inherits from. /// public abstract class VisualStyleFactory { /// /// Create the DefaultVisualStyle for SuperGridControl. /// /// Color-Factory used to generate colors. /// New instance of DefaultVisualStyles class. public abstract DefaultVisualStyles CreateStyle(Rendering.ColorFactory factory); /// /// Create the DefaultVisualStyle for SuperGridControl with empty color factory. /// /// New instance of DefaultVisualStyles class. public virtual DefaultVisualStyles CreateStyle() { if (StyleManager.ColorTint.IsEmpty) return CreateStyle(Rendering.ColorFactory.Empty); return CreateStyle(new Rendering.ColorBlendFactory(StyleManager.ColorTint)); } /// /// Returns the style factory for specified visual style. /// /// Style to create factory for. /// An instance of VisualStyleFactory. public static VisualStyleFactory GetStyleFactory(SuperGridStyle style) { if (style == SuperGridStyle.Office2010Blue) return new Office2010BlueStyleFactory(); if (style == SuperGridStyle.Office2010Silver) return new Office2010SilverStyleFactory(); if (style == SuperGridStyle.Office2010Black) return new Office2010BlackStyleFactory(); if (style == SuperGridStyle.Metro) return new MetroStyleFactory(); throw new ArgumentException(string.Format( "Specified style '{0}' factory has not been implemented.", style)); } } }