InputRoll - make custom column click event args that pass a RollColumn object rather than trying to shoehorn a ListView column click event args object for legacy support
This commit is contained in:
parent
35fa11dc51
commit
56cb685d67
|
@ -245,19 +245,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
[Category("Mouse")]
|
||||
public event CellChangeEventHandler PointedCellChanged;
|
||||
|
||||
// TODO: do not use ColumnClickEventHandler, make a custom one that passes a column object
|
||||
/// <summary>
|
||||
/// Occurs when a column header is clicked
|
||||
/// </summary>
|
||||
[Category("Action")]
|
||||
public event System.Windows.Forms.ColumnClickEventHandler ColumnClick;
|
||||
public event ColumnClickEventHandler ColumnClick;
|
||||
|
||||
// TODO: do not use ColumnClickEventHandler, make a custom one that passes a column object
|
||||
/// <summary>
|
||||
/// Occurs when a column header is right-clicked
|
||||
/// </summary>
|
||||
[Category("Action")]
|
||||
public event System.Windows.Forms.ColumnClickEventHandler ColumnRightClick;
|
||||
public event ColumnClickEventHandler ColumnRightClick;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever the 'SelectedItems' property for this control changes
|
||||
|
@ -290,6 +288,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public delegate void RightMouseScrollEventHandler(object sender, MouseEventArgs e);
|
||||
|
||||
public delegate void ColumnClickEventHandler(object sender, ColumnClickEventArgs e);
|
||||
|
||||
public class CellEventArgs
|
||||
{
|
||||
public CellEventArgs(Cell oldCell, Cell newCell)
|
||||
|
@ -302,6 +302,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Cell NewCell { get; private set; }
|
||||
}
|
||||
|
||||
public class ColumnClickEventArgs
|
||||
{
|
||||
public ColumnClickEventArgs(RollColumn column)
|
||||
{
|
||||
Column = column;
|
||||
}
|
||||
|
||||
public RollColumn Column { get; private set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
|
@ -1195,7 +1205,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (ColumnClick != null)
|
||||
{
|
||||
ColumnClick(this, new ColumnClickEventArgs(_columns.IndexOf(column)));
|
||||
ColumnClick(this, new ColumnClickEventArgs(column));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1213,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (ColumnRightClick != null)
|
||||
{
|
||||
ColumnRightClick(this, new ColumnClickEventArgs(_columns.IndexOf(column)));
|
||||
ColumnRightClick(this, new ColumnClickEventArgs(column));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -745,8 +745,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.TasView.RowCount = 0;
|
||||
this.TasView.Size = new System.Drawing.Size(288, 471);
|
||||
this.TasView.TabIndex = 1;
|
||||
this.TasView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.TasView_ColumnClick);
|
||||
this.TasView.ColumnRightClick += new System.Windows.Forms.ColumnClickEventHandler(this.TasView_ColumnRightClick);
|
||||
this.TasView.ColumnClick += new InputRoll.ColumnClickEventHandler(this.TasView_ColumnClick);
|
||||
this.TasView.ColumnRightClick += new InputRoll.ColumnClickEventHandler(this.TasView_ColumnRightClick);
|
||||
this.TasView.SelectedIndexChanged += new System.EventHandler(this.TasView_SelectedIndexChanged);
|
||||
this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.InputRoll.RightMouseScrollEventHandler(this.TasView_MouseWheel);
|
||||
this.TasView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TasView_KeyDown);
|
||||
|
|
|
@ -188,11 +188,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region Events
|
||||
|
||||
private void TasView_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
private void TasView_ColumnClick(object sender, InputRoll.ColumnClickEventArgs e)
|
||||
{
|
||||
if (TasView.SelectedRows.Any())
|
||||
{
|
||||
var columnName = TasView.VisibleColumns.ToList()[e.Column].Name; // TODO: e
|
||||
var columnName = e.Column.Name;
|
||||
|
||||
if (columnName == FrameColumnName)
|
||||
{
|
||||
|
@ -212,12 +212,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void TasView_ColumnRightClick(object sender, ColumnClickEventArgs e)
|
||||
private void TasView_ColumnRightClick(object sender, InputRoll.ColumnClickEventArgs e)
|
||||
{
|
||||
var column = TasView.AllColumns[e.Column];
|
||||
column.Emphasis ^= true;
|
||||
e.Column.Emphasis ^= true;
|
||||
|
||||
Global.StickyXORAdapter.SetSticky(column.Name, column.Emphasis);
|
||||
Global.StickyXORAdapter.SetSticky(e.Column.Name, e.Column.Emphasis);
|
||||
|
||||
TasView.Refresh();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue