mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							5c119ee0c3
						
					
				
				
					commit
					cb2924a609
				
			@@ -79,5 +79,22 @@ namespace Spectre.Console
 | 
			
		||||
            calendar.HightlightStyle = style ?? Style.Plain;
 | 
			
		||||
            return calendar;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the calendar's header <see cref="Style"/>.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="calendar">The calendar.</param>
 | 
			
		||||
        /// <param name="style">The header style.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Calendar SetHeaderStyle(this Calendar calendar, Style? style)
 | 
			
		||||
        {
 | 
			
		||||
            if (calendar is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(calendar));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            calendar.HeaderStyle = style ?? Style.Plain;
 | 
			
		||||
            return calendar;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ namespace Spectre.Console
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return SetHeader(panel, new PanelHeader(text, style, alignment));
 | 
			
		||||
            return SetHeader(panel, new Title(text, style, alignment));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@@ -36,7 +36,7 @@ namespace Spectre.Console
 | 
			
		||||
        /// <param name="panel">The panel.</param>
 | 
			
		||||
        /// <param name="header">The header to use.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Panel SetHeader(this Panel panel, PanelHeader header)
 | 
			
		||||
        public static Panel SetHeader(this Panel panel, Title header)
 | 
			
		||||
        {
 | 
			
		||||
            if (panel is null)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -176,5 +176,85 @@ namespace Spectre.Console
 | 
			
		||||
            table.ShowHeaders = false;
 | 
			
		||||
            return table;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the table heading.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="text">The heading.</param>
 | 
			
		||||
        /// <param name="style">The style.</param>
 | 
			
		||||
        /// <param name="alignment">The alignment.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetHeading(this Table table, string text, Style? style = null, Justify? alignment = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(table));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (text is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return SetHeading(table, new Title(text, style, alignment));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the table heading.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="heading">The heading.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetHeading(this Table table, Title heading)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(table));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            table.Heading = heading;
 | 
			
		||||
            return table;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the table footnote.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="text">The footnote.</param>
 | 
			
		||||
        /// <param name="style">The style.</param>
 | 
			
		||||
        /// <param name="alignment">The alignment.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetFootnote(this Table table, string text, Style? style = null, Justify? alignment = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(table));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (text is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return SetFootnote(table, new Title(text, style, alignment));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the table footnote.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="footnote">The footnote.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetFootnote(this Table table, Title footnote)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(table));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            table.Footnote = footnote;
 | 
			
		||||
            return table;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user