mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-11 13:11:07 +00:00
dbb93d6c08
1. Top-level menu names are now properly handled. 2. Changing "Any or All terms" option now immediately updates the results. 3. Reformatted menu.zs to have tabs instead of spaces.
52 lines
1.1 KiB
Text
52 lines
1.1 KiB
Text
//=============================================================================
|
|
//
|
|
// Option Search Field class.
|
|
//
|
|
// When the search query is entered, makes Search Menu perform a search.
|
|
//
|
|
//=============================================================================
|
|
|
|
class os_SearchField : OptionMenuItemTextField
|
|
{
|
|
os_SearchField Init(String label, os_Menu menu, string query)
|
|
{
|
|
Super.Init(label, "");
|
|
|
|
mMenu = menu;
|
|
|
|
mText = query;
|
|
|
|
return self;
|
|
}
|
|
|
|
override bool MenuEvent(int mkey, bool fromcontroller)
|
|
{
|
|
if (mkey == Menu.MKEY_Enter)
|
|
{
|
|
Menu.MenuSound("menu/choose");
|
|
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, mText, -1, fromcontroller);
|
|
mEnter.ActivateMenu();
|
|
return true;
|
|
}
|
|
if (mkey == Menu.MKEY_Input)
|
|
{
|
|
mtext = mEnter.GetText();
|
|
|
|
mMenu.search();
|
|
}
|
|
|
|
return Super.MenuEvent(mkey, fromcontroller);
|
|
}
|
|
|
|
override String Represent()
|
|
{
|
|
return mEnter
|
|
? mEnter.GetText() .. SmallFont.GetCursor()
|
|
: mText;
|
|
}
|
|
|
|
String GetText() { return mText; }
|
|
|
|
private os_Menu mMenu;
|
|
private string mText;
|
|
}
|