|
@@ -347,6 +347,12 @@ namespace Terminal.Gui {
|
|
|
for (int c = 0; c < f.Width; c++)
|
|
|
Driver.AddRune (' ');
|
|
|
} else {
|
|
|
+ var rowEventArgs = new ListViewRowEventArgs (item);
|
|
|
+ OnRowRender (rowEventArgs);
|
|
|
+ if (rowEventArgs.RowAttribute != null && current != rowEventArgs.RowAttribute) {
|
|
|
+ current = (Attribute)rowEventArgs.RowAttribute;
|
|
|
+ Driver.SetAttribute (current);
|
|
|
+ }
|
|
|
if (allowsMarking) {
|
|
|
Driver.AddRune (source.IsMarked (item) ? (AllowsMultipleSelection ? Driver.Checked : Driver.Selected) : (AllowsMultipleSelection ? Driver.UnChecked : Driver.UnSelected));
|
|
|
Driver.AddRune (' ');
|
|
@@ -366,6 +372,11 @@ namespace Terminal.Gui {
|
|
|
/// </summary>
|
|
|
public event Action<ListViewItemEventArgs> OpenSelectedItem;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// This event is invoked when this <see cref="ListView"/> is being drawn before rendering.
|
|
|
+ /// </summary>
|
|
|
+ public event Action<ListViewRowEventArgs> RowRender;
|
|
|
+
|
|
|
///<inheritdoc/>
|
|
|
public override bool ProcessKey (KeyEvent kb)
|
|
|
{
|
|
@@ -665,6 +676,15 @@ namespace Terminal.Gui {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Virtual method that will invoke the <see cref="RowRender"/>.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="rowEventArgs"></param>
|
|
|
+ public virtual void OnRowRender (ListViewRowEventArgs rowEventArgs)
|
|
|
+ {
|
|
|
+ RowRender?.Invoke (rowEventArgs);
|
|
|
+ }
|
|
|
+
|
|
|
///<inheritdoc/>
|
|
|
public override bool OnEnter (View view)
|
|
|
{
|
|
@@ -921,4 +941,28 @@ namespace Terminal.Gui {
|
|
|
Value = value;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// <see cref="EventArgs"/> used by the <see cref="ListView.RowRender"/> event.
|
|
|
+ /// </summary>
|
|
|
+ public class ListViewRowEventArgs : EventArgs {
|
|
|
+ /// <summary>
|
|
|
+ /// The current row being rendered.
|
|
|
+ /// </summary>
|
|
|
+ public int Row { get; }
|
|
|
+ /// <summary>
|
|
|
+ /// The <see cref="Attribute"/> used by current row or
|
|
|
+ /// null to maintain the current attribute.
|
|
|
+ /// </summary>
|
|
|
+ public Attribute? RowAttribute { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Initializes with the current row.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="row"></param>
|
|
|
+ public ListViewRowEventArgs (int row)
|
|
|
+ {
|
|
|
+ Row = row;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|