2019-03-16 07:46:48 +00:00
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// 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");
|
2019-03-31 08:06:39 +00:00
|
|
|
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), Menu.OptionFont(), mText, -1, fromcontroller);
|
2019-03-16 07:46:48 +00:00
|
|
|
mEnter.ActivateMenu();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (mkey == Menu.MKEY_Input)
|
|
|
|
{
|
2019-03-17 09:17:12 +00:00
|
|
|
mtext = mEnter.GetText();
|
2019-03-16 07:46:48 +00:00
|
|
|
|
2019-03-17 09:17:12 +00:00
|
|
|
mMenu.search();
|
2019-03-16 07:46:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Super.MenuEvent(mkey, fromcontroller);
|
|
|
|
}
|
|
|
|
|
|
|
|
override String Represent()
|
|
|
|
{
|
|
|
|
return mEnter
|
2019-04-09 18:15:40 +00:00
|
|
|
? mEnter.GetText() .. NewSmallFont.GetCursor()
|
2019-03-16 07:46:48 +00:00
|
|
|
: mText;
|
|
|
|
}
|
|
|
|
|
2019-03-17 09:17:12 +00:00
|
|
|
String GetText() { return mText; }
|
|
|
|
|
2019-03-16 07:46:48 +00:00
|
|
|
private os_Menu mMenu;
|
|
|
|
private string mText;
|
|
|
|
}
|