Add mouse wheel support to UI list boxes
Allows scrolling server browser list and some other lists.
This commit is contained in:
parent
5592342b1b
commit
db1198f6ea
2 changed files with 65 additions and 0 deletions
|
@ -1034,6 +1034,50 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int key )
|
|||
}
|
||||
return (menu_buzz_sound);
|
||||
|
||||
case K_MWHEELUP:
|
||||
if( l->columns > 1 ) {
|
||||
return menu_null_sound;
|
||||
}
|
||||
|
||||
if (l->top > 0)
|
||||
{
|
||||
// if scrolling 3 lines would replace over half of the
|
||||
// displayed items, only scroll 1 item at a time.
|
||||
int scroll = l->height < 6 ? 1 : 3;
|
||||
l->top -= scroll;
|
||||
if (l->top < 0)
|
||||
l->top = 0;
|
||||
|
||||
if (l->generic.callback)
|
||||
l->generic.callback( l, QM_GOTFOCUS );
|
||||
|
||||
// make scrolling silent
|
||||
return (menu_null_sound);
|
||||
}
|
||||
return (menu_buzz_sound);
|
||||
|
||||
case K_MWHEELDOWN:
|
||||
if( l->columns > 1 ) {
|
||||
return menu_null_sound;
|
||||
}
|
||||
|
||||
if (l->top < l->numitems-l->height)
|
||||
{
|
||||
// if scrolling 3 items would replace over half of the
|
||||
// displayed items, only scroll 1 item at a time.
|
||||
int scroll = l->height < 6 ? 1 : 3;
|
||||
l->top += scroll;
|
||||
if (l->top > l->numitems-l->height)
|
||||
l->top = l->numitems-l->height;
|
||||
|
||||
if (l->generic.callback)
|
||||
l->generic.callback( l, QM_GOTFOCUS );
|
||||
|
||||
// make scrolling silent
|
||||
return (menu_null_sound);
|
||||
}
|
||||
return (menu_buzz_sound);
|
||||
|
||||
case K_KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
if( l->curvalue == 0 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue