Changed CellColorGetterDelegate to use its own class for args CellColorGetterArgs to future proof the API against breaking changes

This commit is contained in:
Thomas Nind
2021-07-07 12:15:35 +01:00
parent f536d906d4
commit 29c14876c0
3 changed files with 384 additions and 335 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -319,9 +319,9 @@ namespace UICatalog.Scenarios {
// not a double
TextAlignment.Left,
ColorGetter = (i,v)=>v is double d ?
ColorGetter = (a)=> a.CellValue is double d ?
// color 0 and negative values red
d <= 0.0000001 ? i%2==0 && miAlternatingColors.Checked ? redColorSchemeAlt: redColorScheme :
d <= 0.0000001 ? a.RowIndex%2==0 && miAlternatingColors.Checked ? redColorSchemeAlt: redColorScheme :
// use normal scheme for positive values
null:
// not a double

View File

@@ -511,7 +511,7 @@ namespace Terminal.Gui.Views {
// when B is 2 use the custom highlight colour
ColorScheme cellHighlight = new ColorScheme () { Normal = Attribute.Make (Color.BrightCyan, Color.DarkGray) };
bStyle.ColorGetter = (rowIdx, value) => Convert.ToInt32(value) == 2 ? cellHighlight : null;
bStyle.ColorGetter = (a) => Convert.ToInt32(a.CellValue) == 2 ? cellHighlight : null;
tv.Redraw (tv.Bounds);