namespace Terminal.Gui;
///
/// Defines rendering options that affect how the table is displayed.
/// See TableView Deep Dive for more information.
///
public class TableStyle
{
/// When scrolling down always lock the column headers in place as the first row of the table
public bool AlwaysShowHeaders { get; set; } = false;
///
/// Gets or sets a flag indicating whether to force use when rendering vertical
/// cell lines (even when is on).
///
public bool AlwaysUseNormalColorForVerticalCellLines { get; set; } = false;
/// Collection of columns for which you want special rendering (e.g. custom column lengths, text justification, etc.)
public Dictionary ColumnStyles { get; set; } = new ();
///
/// Determines rendering when the last column in the table is visible, but it's content or
/// is less than the remaining space in the control. True (the default) will expand
/// the column to fill the remaining bounds of the control. False will draw a column ending line and leave a blank
/// column that cannot be selected in the remaining space.
///
///
public bool ExpandLastColumn { get; set; } = true;
///
/// True to invert the colors of the first symbol of the selected cell in the . This gives
/// the appearance of a cursor for when the doesn't otherwise show this
///
public bool InvertSelectedCellFirstCharacter { get; set; } = false;
///
/// Delegate for coloring specific rows in a different color. For cell color
///
///
///
public RowColorGetterDelegate RowColorGetter { get; set; }
///
/// Gets or sets a flag indicating whether to render headers of a . Defaults to
/// .
///
///
/// , etc may still be used
/// even if is .
///
public bool ShowHeaders { get; set; } = true;
///
/// Gets or sets a flag indicating whether there should be a horizontal line after all the data in the table.
/// Defaults to .
///
public bool ShowHorizontalBottomline { get; set; } = false;
/// True to render a solid line above the headers
public bool ShowHorizontalHeaderOverline { get; set; } = true;
/// True to render a solid line under the headers
public bool ShowHorizontalHeaderUnderline { get; set; } = true;
///
/// True to render a arrows on the right/left of the table when there are more column(s) that can be scrolled to.
/// Requires to be true. Defaults to true
///
public bool ShowHorizontalScrollIndicators { get; set; } = true;
/// True to render a solid line vertical line between cells
public bool ShowVerticalCellLines { get; set; } = true;
/// True to render a solid line vertical line between headers
public bool ShowVerticalHeaderLines { get; set; } = true;
///
///
/// Determines how is updated when scrolling right off the end of the
/// currently visible area.
///
///
/// If true then when scrolling right the scroll offset is increased the minimum required to show the new column.
/// This may be slow if you have an incredibly large number of columns in your table and/or slow
/// implementations
///
/// If false then scroll offset is set to the currently selected column (i.e. PageRight).
///
public bool SmoothHorizontalScrolling { get; set; } = true;
///
/// Returns the entry from for the given or null if no custom
/// styling is defined for it
///
///
///
public ColumnStyle GetColumnStyleIfAny (int col) { return ColumnStyles.TryGetValue (col, out ColumnStyle result) ? result : null; }
///
/// Returns an existing for the given or creates a new one with
/// default options
///
///
///
public ColumnStyle GetOrCreateColumnStyle (int col)
{
if (!ColumnStyles.ContainsKey (col))
{
ColumnStyles.Add (col, new ColumnStyle ());
}
return ColumnStyles [col];
}
}