mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Action Selector control: actions can now be scrolled using up/down keys and mouse wheel.
This commit is contained in:
parent
62e5f0b762
commit
cc1c407756
1 changed files with 40 additions and 0 deletions
|
@ -50,6 +50,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
number.MouseWheel += number_OnMouseWheel; //mxd
|
||||
}
|
||||
|
||||
// This returns the numeric value
|
||||
|
@ -223,6 +224,30 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Allow CTRL+X, CTRL+C and CTRL+V
|
||||
if(controlpressed && ((e.KeyCode == Keys.X) || (e.KeyCode == Keys.C) || (e.KeyCode == Keys.V))) return;
|
||||
|
||||
//mxd. Scroll action list using arrow keys
|
||||
if (e.KeyCode == Keys.Down)
|
||||
{
|
||||
if (list.SelectedIndex > 0)
|
||||
{
|
||||
list.SelectedIndex--;
|
||||
list_SelectionChangeCommitted(list, EventArgs.Empty);
|
||||
}
|
||||
// Cancel this
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
if(e.KeyCode == Keys.Up)
|
||||
{
|
||||
if (list.SelectedIndex < list.Items.Count)
|
||||
{
|
||||
list.SelectedIndex++;
|
||||
list_SelectionChangeCommitted(list, EventArgs.Empty);
|
||||
}
|
||||
// Cancel this
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Not numeric or control key?
|
||||
if(((e.KeyValue < 48) || (e.KeyValue > 57)) &&
|
||||
(e.KeyCode != Keys.Back) && (e.KeyCode != Keys.Left) &&
|
||||
|
@ -246,6 +271,21 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Scrolls action list using mouse wheel
|
||||
private void number_OnMouseWheel(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Delta < 0 && list.SelectedIndex > 0)
|
||||
{
|
||||
list.SelectedIndex--;
|
||||
list_SelectionChangeCommitted(list, EventArgs.Empty);
|
||||
}
|
||||
else if (e.Delta > 0 && list.SelectedIndex < list.Items.Count)
|
||||
{
|
||||
list.SelectedIndex++;
|
||||
list_SelectionChangeCommitted(list, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
// Selection made
|
||||
private void list_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in a new issue