Input Roll - progress on scroll bars
This commit is contained in:
parent
e09e10d90c
commit
8c7fc8ffd9
|
@ -15,21 +15,30 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private readonly RollColumns Columns = new RollColumns();
|
private readonly RollColumns Columns = new RollColumns();
|
||||||
private readonly List<Cell> SelectedItems = new List<Cell>();
|
private readonly List<Cell> SelectedItems = new List<Cell>();
|
||||||
|
|
||||||
private readonly VScrollBar VBar = new VScrollBar
|
private readonly VScrollBar VBar;
|
||||||
{
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly HScrollBar HBar = new HScrollBar
|
private readonly HScrollBar HBar;
|
||||||
{
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
|
|
||||||
private int _horizontalOrientedColumnWidth = 0;
|
private int _horizontalOrientedColumnWidth = 0;
|
||||||
|
private int _itemCount = 0;
|
||||||
private Size _charSize;
|
private Size _charSize;
|
||||||
|
|
||||||
public InputRoll()
|
public InputRoll()
|
||||||
{
|
{
|
||||||
|
VBar = new VScrollBar
|
||||||
|
{
|
||||||
|
Location = new Point(Width - 16, 0),
|
||||||
|
Visible = false,
|
||||||
|
Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom
|
||||||
|
};
|
||||||
|
|
||||||
|
HBar = new HScrollBar
|
||||||
|
{
|
||||||
|
Location = new Point(0, Height - 16),
|
||||||
|
Visible = false,
|
||||||
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right
|
||||||
|
};
|
||||||
|
|
||||||
CellPadding = 3;
|
CellPadding = 3;
|
||||||
CurrentCell = null;
|
CurrentCell = null;
|
||||||
Font = new Font("Courier New", 8); // Only support fixed width
|
Font = new Font("Courier New", 8); // Only support fixed width
|
||||||
|
@ -46,6 +55,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_charSize = Gdi.MeasureString("A", this.Font);
|
_charSize = Gdi.MeasureString("A", this.Font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Controls.Add(VBar);
|
||||||
|
this.Controls.Add(HBar);
|
||||||
|
RecalculateScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
|
@ -76,7 +89,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// Gets or sets the sets the virtual number of items to be displayed.
|
/// Gets or sets the sets the virtual number of items to be displayed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Category("Behavior")]
|
[Category("Behavior")]
|
||||||
public int ItemCount { get; set; }
|
public int ItemCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _itemCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_itemCount = value;
|
||||||
|
RecalculateScrollBars();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the sets the columns can be resized
|
/// Gets or sets the sets the columns can be resized
|
||||||
|
@ -234,6 +259,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
|
VBar.Location = new Point(Width - 16, 0);
|
||||||
using (var LCK = Gdi.LockGraphics(e.Graphics))
|
using (var LCK = Gdi.LockGraphics(e.Graphics))
|
||||||
{
|
{
|
||||||
Gdi.StartOffScreenBitmap(Width, Height);
|
Gdi.StartOffScreenBitmap(Width, Height);
|
||||||
|
@ -646,8 +672,57 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Change Events
|
||||||
|
|
||||||
|
protected override void OnResize(EventArgs e)
|
||||||
|
{
|
||||||
|
RecalculateScrollBars();
|
||||||
|
base.OnResize(e);
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Helpers
|
#region Helpers
|
||||||
|
|
||||||
|
private void RecalculateScrollBars()
|
||||||
|
{
|
||||||
|
if (NeedsVScrollbar)
|
||||||
|
{
|
||||||
|
VBar.Visible = true;
|
||||||
|
if (HorizontalOrientation)
|
||||||
|
{
|
||||||
|
VBar.Maximum = Columns.Count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VBar.Maximum = ItemCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VBar.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NeedsHScrollbar)
|
||||||
|
{
|
||||||
|
HBar.Visible = true;
|
||||||
|
if (HorizontalOrientation)
|
||||||
|
{
|
||||||
|
HBar.Maximum = ItemCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HBar.Maximum = Columns.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HBar.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SelectCell(Cell cell)
|
private void SelectCell(Cell cell)
|
||||||
{
|
{
|
||||||
if (!MultiSelect)
|
if (!MultiSelect)
|
||||||
|
|
|
@ -66,14 +66,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void TasView_QueryItemText(int index, int column, out string text)
|
private void TasView_QueryItemText(int index, int column, out string text)
|
||||||
{
|
{
|
||||||
|
text = "";
|
||||||
if (columnClicked.HasValue && column == columnClicked)
|
if (columnClicked.HasValue && column == columnClicked)
|
||||||
{
|
{
|
||||||
text = "!";
|
text = "!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = r.NextDouble() > .5 ? "_" : "";
|
if (index < InputView.ItemCount)
|
||||||
|
{
|
||||||
|
text = r.NextDouble() > .5 ? "_" : "";
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
text = string.Empty;
|
text = string.Empty;
|
||||||
|
@ -252,6 +255,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Type = InputRoll.RollColumn.InputType.Boolean
|
Type = InputRoll.RollColumn.InputType.Boolean
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
InputView.ItemCount = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void settingsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
private void settingsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue