Input Roll - mouse wheel scrolling

This commit is contained in:
adelikat 2014-08-29 15:53:59 +00:00
parent 2aa7a09e25
commit 32795e1364
1 changed files with 35 additions and 1 deletions

View File

@ -914,6 +914,31 @@ namespace BizHawk.Client.EmuHawk
base.OnMouseUp(e); base.OnMouseUp(e);
} }
private void IncrementScrollBar(ScrollBar bar, bool increment)
{
int newVal;
if (increment)
{
newVal = bar.Value + bar.SmallChange;
if (newVal > bar.Maximum)
{
newVal = bar.Maximum;
}
}
else
{
newVal = bar.Value - bar.SmallChange;
if (newVal < 0)
{
newVal = 0;
}
}
_programmaticallyUpdatingScrollBarValues = true;
bar.Value = newVal;
_programmaticallyUpdatingScrollBarValues = false;
}
protected override void OnMouseWheel(MouseEventArgs e) protected override void OnMouseWheel(MouseEventArgs e)
{ {
if (RightButtonHeld) if (RightButtonHeld)
@ -922,7 +947,16 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
base.OnMouseWheel(e); if (HorizontalOrientation)
{
IncrementScrollBar(HBar, e.Delta < 0);
}
else
{
IncrementScrollBar(VBar, e.Delta < 0);
}
Refresh();
} }
} }