Table Class
Definition
Section titled “Definition”A scrollable table control.
public class Table : CompositeControl, IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerableInheritance object → ControlBase → CompositeControl
Implements IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerable
Constructors
Section titled “Constructors”Table(int, int)
Section titled “Table(int, int)”Creates a new table with the default SadConsole colors, and cell size of (1 width, 1 height)
public Table(int width, int height)Parameters
Section titled “Parameters”width int
height int
Table(int, int, int, int)
Section titled “Table(int, int, int, int)”Creates a new table with custom cell width and cell height params; Uses the default SadConsole colors
public Table(int width, int height, int cellWidth, int cellHeight = 1)Parameters
Section titled “Parameters”width int
height int
cellWidth int
cellHeight int
Table(int, int, int, Color, Color, int)
Section titled “Table(int, int, int, Color, Color, int)”Creates a new table with extra params to set the base default values of the table
public Table(int width, int height, int cellWidth, Color defaultForeground, Color defaultBackground, int cellHeight = 1)Parameters
Section titled “Parameters”width int
height int
cellWidth int
defaultForeground SadRogue.Primitives.Color
defaultBackground SadRogue.Primitives.Color
cellHeight int
Properties
Section titled “Properties”The cells collection used to modify the table cells
public Table.TableCells Cells { get; }DefaultForeground
Section titled “DefaultForeground”The default foreground color used for the table foreground and newly created cells
public Color DefaultForeground { get; set; }DefaultBackground
Section titled “DefaultBackground”The default background color used for the table background and newly created cells
public Color DefaultBackground { get; set; }DefaultCellSize
Section titled “DefaultCellSize”The default size a cell gets when it is newly created
public Point DefaultCellSize { get; set; }DefaultHoverMode
Section titled “DefaultHoverMode”The default visual hovering mode when hovering over cells
public Table.TableCells.Layout.Mode DefaultHoverMode { get; set; }DefaultSelectionMode
Section titled “DefaultSelectionMode”The default visual selection mode when selecting a cell
public Table.TableCells.Layout.Mode DefaultSelectionMode { get; set; }UseMouse
Section titled “UseMouse”When true, this object will use the mouse; otherwise false.
public bool UseMouse { get; set; }CurrentMouseCell
Section titled “CurrentMouseCell”Returns the cell the mouse is over, if UseMouse is true.
public Table.Cell? CurrentMouseCell { get; }SelectedCell
Section titled “SelectedCell”Returns the current selected cell
public Table.Cell? SelectedCell { get; }DrawFakeCells
Section titled “DrawFakeCells”By default, only cells that have been modified in anyway will be rendered on the table control. Turn this off, if the whole table should draw as many cells as it fits with their default layout.
public bool DrawFakeCells { get; set; }VerticalScrollBar
Section titled “VerticalScrollBar”The vertical scrollbar, use the SetupScrollBar method with Vertical orientation to initialize it.
public ScrollBar? VerticalScrollBar { get; }HorizontalScrollBar
Section titled “HorizontalScrollBar”The horizontal scrollbar, use the SetupScrollBar method with Horizontal orientation to initialize it.
public ScrollBar? HorizontalScrollBar { get; }IsVerticalScrollBarVisible
Section titled “IsVerticalScrollBarVisible”Returns true if the vertical scroll bar is currently visible.
public bool IsVerticalScrollBarVisible { get; }IsHorizontalScrollBarVisible
Section titled “IsHorizontalScrollBarVisible”Returns true if the horizontal scroll bar is currently visible.
public bool IsHorizontalScrollBarVisible { get; }VerticalScrollBarMaximum
Section titled “VerticalScrollBarMaximum”The updated maximum value, incase the scrollbar object’s maximum value is not yet updated by the theme.
public int VerticalScrollBarMaximum { get; }HorizontalScrollBarMaximum
Section titled “HorizontalScrollBarMaximum”The updated maximum value, incase the scrollbar object’s maximum value is not yet updated by the theme.
public int HorizontalScrollBarMaximum { get; }AutoScrollOnCellSelection
Section titled “AutoScrollOnCellSelection”By default the table will automatically scroll to the selected cell if possible.
public bool AutoScrollOnCellSelection { get; set; }Methods
Section titled “Methods”SetupScrollBar(Orientation, int, Point)
Section titled “SetupScrollBar(Orientation, int, Point)”Configures the associated VerticalScrollBar.
public void SetupScrollBar(Orientation orientation, int size, Point position)Parameters
Section titled “Parameters”orientation Orientation
The orientation of the scrollbar.
size int
position SadRogue.Primitives.Point
The position of the scrollbar.
ScrollToSelectedItem()
Section titled “ScrollToSelectedItem()”Scrolls the list to the item currently selected.
public void ScrollToSelectedItem()OnMouseIn(ControlMouseState)
Section titled “OnMouseIn(ControlMouseState)”Called as the mouse moves around the control area. Raises the MouseMove event and calls the DetermineState() method.
protected override void OnMouseIn(ControlBase.ControlMouseState state)Parameters
Section titled “Parameters”state ControlBase.ControlMouseState
The current mouse data
OnLeftMouseClicked(ControlMouseState)
Section titled “OnLeftMouseClicked(ControlMouseState)”Called when the left mouse button is clicked. Raises the MouseButtonClicked event and calls the DetermineState() method.
protected override void OnLeftMouseClicked(ControlBase.ControlMouseState state)Parameters
Section titled “Parameters”state ControlBase.ControlMouseState
The current mouse data
OnRightMouseClicked(ControlMouseState)
Section titled “OnRightMouseClicked(ControlMouseState)”Called when the right mouse button is clicked. Raises the MouseButtonClicked event and calls the DetermineState() method.
protected override void OnRightMouseClicked(ControlBase.ControlMouseState state)Parameters
Section titled “Parameters”state ControlBase.ControlMouseState
The current mouse data.
OnMouseExit(ControlMouseState)
Section titled “OnMouseExit(ControlMouseState)”Called when the mouse exits the area of the control. Raises the MouseExit event and calls the DetermineState() method.
protected override void OnMouseExit(ControlBase.ControlMouseState state)Parameters
Section titled “Parameters”state ControlBase.ControlMouseState
The current mouse data
UpdateAndRedraw(TimeSpan)
Section titled “UpdateAndRedraw(TimeSpan)”Updates each control hosted by this control.
public override void UpdateAndRedraw(TimeSpan time)Parameters
Section titled “Parameters”time TimeSpan
The game frame time delta.
GetOldRowAndColumnValues(List<((int x, int y), (int row, int col))>?, Point, ref int, ref int)
Section titled “GetOldRowAndColumnValues(List<((int x, int y), (int row, int col))>?, Point, ref int, ref int)”protected void GetOldRowAndColumnValues(List<((int x, int y), (int row, int col))>? fakeCells, Point cellPosition, ref int oldRow, ref int oldCol)Parameters
Section titled “Parameters”fakeCells List<((int x, int y), (int row, int col))>
cellPosition SadRogue.Primitives.Point
oldRow int
oldCol int
SetScrollBarVisibility(int, int)
Section titled “SetScrollBarVisibility(int, int)”protected void SetScrollBarVisibility(int maxRowsHeight, int maxColumnsWidth)Parameters
Section titled “Parameters”maxRowsHeight int
maxColumnsWidth int
GetCustomStateAppearance(Cell)
Section titled “GetCustomStateAppearance(Cell)”protected ColoredGlyphBase? GetCustomStateAppearance(Table.Cell cell)Parameters
Section titled “Parameters”cell Table.Cell
Returns
Section titled “Returns”AdjustControlSurface(Cell, ColoredGlyphBase?, bool)
Section titled “AdjustControlSurface(Cell, ColoredGlyphBase?, bool)”protected void AdjustControlSurface(Table.Cell cell, ColoredGlyphBase? customStateAppearance, bool adjustVisibility)Parameters
Section titled “Parameters”cell Table.Cell
customStateAppearance ColoredGlyphBase
adjustVisibility bool
HideVisualCell(int, int, Point)
Section titled “HideVisualCell(int, int, Point)”protected void HideVisualCell(int column, int row, Point position)Parameters
Section titled “Parameters”column int
row int
position SadRogue.Primitives.Point
PrintText(Cell)
Section titled “PrintText(Cell)”protected void PrintText(Table.Cell cell)Parameters
Section titled “Parameters”cell Table.Cell
GetTotalCellSize(Cell, int, int, out int, out int)
Section titled “GetTotalCellSize(Cell, int, int, out int, out int)”protected static void GetTotalCellSize(Table.Cell cell, int width, int height, out int totalWidth, out int totalHeight)Parameters
Section titled “Parameters”cell Table.Cell
width int
height int
totalWidth int
totalHeight int
GetHorizontalAlignment(HorizontalAlign, int, char[])
Section titled “GetHorizontalAlignment(HorizontalAlign, int, char[])”protected static int GetHorizontalAlignment(Table.Cell.Options.HorizontalAlign hAlign, int totalWidth, char[] textArr)Parameters
Section titled “Parameters”hAlign Table.Cell.Options.HorizontalAlign
totalWidth int
textArr char[]
Returns
Section titled “Returns”Events
Section titled “Events”OnCellEnter
Section titled “OnCellEnter”Fires an event when a cell is entered by the mouse.
public event EventHandler<Table.CellEventArgs>? OnCellEnterEvent Type
Section titled “Event Type”EventHandler<Table.CellEventArgs>
OnCellExit
Section titled “OnCellExit”Fires an event when a cell is exited by the mouse.
public event EventHandler<Table.CellEventArgs>? OnCellExitEvent Type
Section titled “Event Type”EventHandler<Table.CellEventArgs>
SelectedCellChanged
Section titled “SelectedCellChanged”Fires an event when the selected cell has changed.
public event EventHandler<Table.CellChangedEventArgs>? SelectedCellChangedEvent Type
Section titled “Event Type”EventHandler<Table.CellChangedEventArgs>
OnCellLeftClick
Section titled “OnCellLeftClick”Fires an event when a cell is left clicked.
public event EventHandler<Table.CellEventArgs>? OnCellLeftClickEvent Type
Section titled “Event Type”EventHandler<Table.CellEventArgs>
OnCellRightClick
Section titled “OnCellRightClick”Fires an event when a cell is right clicked.
public event EventHandler<Table.CellEventArgs>? OnCellRightClickEvent Type
Section titled “Event Type”EventHandler<Table.CellEventArgs>
OnCellDoubleClick
Section titled “OnCellDoubleClick”Fires an event when a cell is double clicked.
public event EventHandler<Table.CellEventArgs>? OnCellDoubleClickEvent Type
Section titled “Event Type”EventHandler<Table.CellEventArgs>
OnDrawFakeCell
Section titled “OnDrawFakeCell”Called when a fake cells is being drawn, you can use this to modify the cell layout.
public event EventHandler<Table.CellEventArgs>? OnDrawFakeCell