mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-03-10 03:02:21 +00:00
This commit is contained in:
parent
b27e6ee79d
commit
233ad7a306
1 changed files with 23 additions and 0 deletions
|
@ -201,6 +201,29 @@ class OptionMenu : Menu
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else if (ev.type == UIEvent.Type_Char)
|
||||
{
|
||||
int key = String.CharLower(ev.keyChar);
|
||||
int itemsNumber = mDesc.mItems.Size();
|
||||
int direction = ev.IsAlt ? -1 : 1;
|
||||
for (int i = 0; i < itemsNumber; ++i)
|
||||
{
|
||||
int index = (mDesc.mSelectedItem + direction * (i + 1) + itemsNumber) % itemsNumber;
|
||||
if (!mDesc.mItems[index].Selectable()) continue;
|
||||
String label = StringTable.Localize(mDesc.mItems[index].mLabel);
|
||||
int firstLabelCharacter = String.CharLower(label.GetNextCodePoint(0));
|
||||
if (firstLabelCharacter == key)
|
||||
{
|
||||
mDesc.mSelectedItem = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mDesc.mSelectedItem <= mDesc.mScrollTop + mDesc.mScrollPos
|
||||
|| mDesc.mSelectedItem >= VisBottom)
|
||||
{
|
||||
mDesc.mScrollPos = MAX(mDesc.mSelectedItem - mDesc.mScrollTop - 1, 0);
|
||||
}
|
||||
}
|
||||
return Super.OnUIEvent(ev);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue