/// <summary> /// Customizes an existing Mvc.RazorTools.FontAwesome.FontAwesomeStack by adding /// class attributes and returning the object. This method can be chained to /// apply multiple styles. /// </summary> /// <param name="stack">The existing Mvc.RazorTools.FontAwesome.FontAwesomeStack to modify.</param> /// <param name="items">The class attributes to be added to the existing instance.</param> /// <returns>A new modified instance of the Mvc.RazorTools.FontAwesome.FontAwesomeStack object.</returns> public static FaStack Customize([NotNull] this FaStack stack, [NotNull] params string[] items) { FaStack returnValue = stack.Clone() as FaStack; // *** // *** Make a copy of each class descriptor // *** foreach (string item in items) { returnValue.UpdateClassAttribute(item); } return(returnValue); }
/// <summary> /// /// </summary> /// <returns></returns> protected override object OnClone() { FaStack returnValue = new FaStack(); foreach (FaIcon item in this.Items) { returnValue.Items.Add((FaIcon)item.Clone()); } // *** // *** Cloning always unlocks the object // *** returnValue.Locked = false; returnValue.MergeClassAttributes(this.ClassAttributes); return(returnValue); }
/// <summary> /// /// </summary> /// <param name="stack"></param> /// <param name="size"></param> /// <returns></returns> public static FaStack WithSize([NotNull] this FaStack stack, [NotNull] FaSize size) { return(stack.Customize(size.ClassAttribute)); }