浏览代码

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

Thomas Nind 4 年之前
父节点
当前提交
29c14876c0
共有 3 个文件被更改,包括 286 次插入282 次删除
  1. 283 279
      Terminal.Gui/Views/TableView.cs
  2. 2 2
      UICatalog/Scenarios/TableEditor.cs
  3. 1 1
      UnitTests/TableViewTests.cs

文件差异内容过多而无法显示
+ 283 - 279
Terminal.Gui/Views/TableView.cs


+ 2 - 2
UICatalog/Scenarios/TableEditor.cs

@@ -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

+ 1 - 1
UnitTests/TableViewTests.cs

@@ -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);
 

部分文件因为文件数量过多而无法显示