mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-31 09:01:54 +00:00
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
|
@ -1828,6 +1828,27 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
|
|||
return qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
// Use mouse wheel in vertical and horizontal menus.
|
||||
// If scrolling 3 items would replace over half of the
|
||||
// displayed items, only scroll 1 item at a time.
|
||||
if ( key == K_MWHEELUP ) {
|
||||
int scroll = viewmax < 6 ? 1 : 3;
|
||||
listPtr->startPos -= scroll;
|
||||
if (listPtr->startPos < 0) {
|
||||
listPtr->startPos = 0;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
if ( key == K_MWHEELDOWN ) {
|
||||
int scroll = viewmax < 6 ? 1 : 3;
|
||||
listPtr->startPos += scroll;
|
||||
if (listPtr->startPos > max) {
|
||||
listPtr->startPos = max;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
// mouse hit
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2) {
|
||||
if (item->window.flags & WINDOW_LB_LEFTARROW) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue