Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the Mvc.RazorTools.FontAwesome.FontAwesomeStack
 /// object the specified top icon, middle icon and bottom icon.
 /// </summary>
 /// <param name="topItem">The top icon in the stack.</param>
 /// <param name="middleItem">The middle icon in the stack.</param>
 /// <param name="bottomItem">The bottom icon in the stack.</param>
 public FaStack(FaIcon topItem, FaIcon middleItem, FaIcon bottomItem)
     : this()
 {
     this.Items.Add(topItem);
     this.Items.Add(middleItem);
     this.Items.Add(bottomItem);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the Mvc.RazorTools.FontAwesome.FontAwesomeStack
 /// object the specified top icon, bottom icon and custom class attributes.
 /// </summary>
 /// <param name="topItem">The top icon in the stack.</param>
 /// <param name="bottomItem">The bottom icon in the stack.</param>
 /// <param name="classAttributes">The custom class attributes applied to the stack HTML tag (not the icons).</param>
 public FaStack(FaIcon topItem, FaIcon bottomItem, IDictionary <string, string> classAttributes)
     : this()
 {
     this.Items.Add(topItem);
     this.Items.Add(bottomItem);
     this.MergeClassAttributes(classAttributes);
 }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tagBuilder"></param>
        protected override void OnGetInnerHtml(TagBuilder tagBuilder)
        {
            // ***
            // *** Build text that will place each icon between the tags
            // ***
            foreach (FaIcon item in this.Items)
            {
                FaIcon icon = (FaIcon)item.Clone();

                // ***
                // *** The icon must have either the Stack1x or Stack2x attribute set
                // ***
                if (!icon.ClassAttributes.ContainsKey(FaStackAttributes.Stack1x.ClassAttribute) &&
                    !icon.ClassAttributes.ContainsKey(FaStackAttributes.Stack2x.ClassAttribute))
                {
                    // ***
                    // *** Default to Stack1x
                    // ***
                    icon.AddClassAttribute(FaStackAttributes.Stack1x.ClassAttribute);
                }

                // ***
                // *** Add the HTML markup to the TagBuilder object
                // ***
                throw new System.Exception("Come back and fix this!");
                //html.InnerHtml += icon.Html.ToString();
            }
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override object OnClone()
        {
            FaIcon returnValue = FaIcon.Create(this.IconId, this.Unicode);

            returnValue.Locked = false;
            returnValue.MergeClassAttributes(this.ClassAttributes);
            return(returnValue);
        }
Beispiel #5
0
        /// <summary>
        /// Initializes and returns a new instance of a <see cref="FaIcon"/> object
        /// with the specified Id, Unicode value and custom class attributes.
        /// </summary>
        /// <param name="iconId">The CSS style sheet name of the icon this instance represents.</param>
        /// <param name="unicode">A <see cref="Int32"/> value that represents the Unicode value of the font.</param>
        /// <param name="classAttributes">A list of custom class attributes for this instance.</param>
        /// <returns>A newly initialized <see cref="FaIcon"/> object.</returns>
        public static FaIcon Create(string iconId, int unicode, IDictionary <string, string> classAttributes)
        {
            FaIcon returnValue = new FaIcon(iconId, unicode);

            returnValue.MergeClassAttributes(classAttributes);

            return(returnValue);
        }
Beispiel #6
0
 /// <summary>
 /// All of the icons in <see cref="FaIcons"/> are locked and can be modified. This method creates
 /// a copy of the specified icon that can be styled and modified in a Razor view/page.
 /// </summary>
 /// <param name="item">The <see cref="FaIcon"/> instance that is being created.</param>
 /// <returns>Returns an instance of <see cref="FaIcon"/> that can be styled and modified.</returns>
 public static FaIcon Create([NotNull] this FaIcon item)
 {
     return((FaIcon)item.Clone());
 }
Beispiel #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="transform"></param>
 /// <returns></returns>
 public static FaIcon WithTransform([NotNull] this FaIcon icon, [NotNull] FaTransform transform)
 {
     icon.AddClassAttribute(transform.ClassAttribute);
     return(icon);
 }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="name"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static FaIcon WithCssStyle([NotNull] this FaIcon icon, [NotNull] string name, [NotNull] string value)
 {
     icon.AddStyle(name, value);
     return(icon);
 }
Beispiel #9
0
 /// <summary>
 /// Add any custom class attribute to the icon.
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="classAttribute"></param>
 /// <returns></returns>
 public static FaIcon WithClass([NotNull] this FaIcon icon, [NotNull] string classAttribute)
 {
     icon.AddClassAttribute(classAttribute);
     return(icon);
 }
Beispiel #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="option"></param>
 /// <returns></returns>
 public static FaIcon WithOption([NotNull] this FaIcon icon, [NotNull] FaOption option)
 {
     icon.AddClassAttribute(option.ClassAttribute);
     return(icon);
 }
Beispiel #11
0
 /// <summary>
 /// Applies a resizing option to the icon.
 /// </summary>
 /// <param name="icon">The icon the style is applied.</param>
 /// <param name="size">An <see cref="FaSize"/> to increase or decrease the default size.</param>
 /// <returns></returns>
 public static FaIcon WithSize([NotNull] this FaIcon icon, [NotNull] FaSize size)
 {
     icon.AddClassAttribute(size.ClassAttribute);
     return(icon);
 }
Beispiel #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="icon"></param>
 /// <returns></returns>
 public static FaIcon AsBrand([NotNull] this FaIcon icon)
 {
     icon.AddClassAttribute("fab");
     return(icon);
 }
Beispiel #13
0
 /// <summary>
 /// Applies a style to the icon.
 /// </summary>
 /// <param name="icon">The icon the style is applied.</param>
 /// <param name="style">The <see cref="FaStyle"/> that will be
 /// applied to the icon.</param>
 /// <returns>The updated icon.</returns>
 public static FaIcon WithStyle([NotNull] this FaIcon icon, [NotNull] FaStyle style)
 {
     icon.AddClassAttribute(style.ClassAttribute);
     return(icon);
 }
Beispiel #14
0
 /// <summary>
 /// Gets the class attribute value only for the given FontAwesomeIcon instance.
 /// </summary>
 /// <param name="icon">The existing <see cref="FaIcon"/> to modify.</param>
 /// <returns>A <see cref="String"/> value containing the class attribute value from the HTML markup
 /// generated for this icon.</returns>
 public static string CssOnly(this FaIcon icon)
 {
     return(icon.ClassAttributes.Values.Aggregate(String.Empty, (o, i) => o + Constants.Space + i).TrimStart());
 }
Beispiel #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="attribute"></param>
 /// <returns></returns>
 public static FaIcon WithStackAttribute([NotNull] this FaIcon icon, [NotNull] FaStackAttribute attribute)
 {
     icon.AddClassAttribute(attribute.ClassAttribute);
     return(icon);
 }
Beispiel #16
0
 /// <summary>
 /// Initializes anew instance of the Mvc.RazorTools.FontAwesome.FontAwesomeStack
 /// object the specified top icon.
 /// </summary>
 /// <param name="topItem">The top icon in the stack.</param>
 public FaStack(FaIcon topItem)
     : this()
 {
     this.Items.Add(topItem);
 }