mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Remove default focus from spellbook search, allow toggling focus via shortcut
This commit is contained in:
@@ -295,6 +295,7 @@ enum class EShortcut
|
|||||||
// Spellbook screen
|
// Spellbook screen
|
||||||
SPELLBOOK_TAB_ADVENTURE,
|
SPELLBOOK_TAB_ADVENTURE,
|
||||||
SPELLBOOK_TAB_COMBAT,
|
SPELLBOOK_TAB_COMBAT,
|
||||||
|
SPELLBOOK_SEARCH_FOCUS,
|
||||||
|
|
||||||
LIST_HERO_UP,
|
LIST_HERO_UP,
|
||||||
LIST_HERO_DOWN,
|
LIST_HERO_DOWN,
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
|
|||||||
{"heroCostumeLoad9", EShortcut::HERO_COSTUME_LOAD_9 },
|
{"heroCostumeLoad9", EShortcut::HERO_COSTUME_LOAD_9 },
|
||||||
{"spellbookTabAdventure", EShortcut::SPELLBOOK_TAB_ADVENTURE },
|
{"spellbookTabAdventure", EShortcut::SPELLBOOK_TAB_ADVENTURE },
|
||||||
{"spellbookTabCombat", EShortcut::SPELLBOOK_TAB_COMBAT },
|
{"spellbookTabCombat", EShortcut::SPELLBOOK_TAB_COMBAT },
|
||||||
|
{"spellbookSearchFocus", EShortcut::SPELLBOOK_SEARCH_FOCUS },
|
||||||
{"listHeroUp", EShortcut::LIST_HERO_UP },
|
{"listHeroUp", EShortcut::LIST_HERO_UP },
|
||||||
{"listHeroDown", EShortcut::LIST_HERO_DOWN },
|
{"listHeroDown", EShortcut::LIST_HERO_DOWN },
|
||||||
{"listHeroTop", EShortcut::LIST_HERO_TOP },
|
{"listHeroTop", EShortcut::LIST_HERO_TOP },
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _m
|
|||||||
searchBoxRectangle = std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor);
|
searchBoxRectangle = std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor);
|
||||||
searchBoxDescription = std::make_shared<CLabel>(r.center().x, r.center().y, FONT_SMALL, ETextAlignment::CENTER, grayedColor, CGI->generaltexth->translate("vcmi.spellBook.search"));
|
searchBoxDescription = std::make_shared<CLabel>(r.center().x, r.center().y, FONT_SMALL, ETextAlignment::CENTER, grayedColor, CGI->generaltexth->translate("vcmi.spellBook.search"));
|
||||||
|
|
||||||
searchBox = std::make_shared<CTextInput>(r, FONT_SMALL, ETextAlignment::CENTER, true);
|
searchBox = std::make_shared<CTextInput>(r, FONT_SMALL, ETextAlignment::CENTER, false);
|
||||||
searchBox->setCallback(std::bind(&CSpellWindow::searchInput, this));
|
searchBox->setCallback(std::bind(&CSpellWindow::searchInput, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,6 +354,14 @@ void CSpellWindow::fbattleSpellsb()
|
|||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSpellWindow::toggleSearchBoxFocus()
|
||||||
|
{
|
||||||
|
if(searchBox != nullptr)
|
||||||
|
{
|
||||||
|
searchBox->hasFocus() ? searchBox->removeFocus() : searchBox->giveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSpellWindow::fmanaPtsb()
|
void CSpellWindow::fmanaPtsb()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -546,6 +554,9 @@ void CSpellWindow::keyPressed(EShortcut key)
|
|||||||
case EShortcut::SPELLBOOK_TAB_ADVENTURE:
|
case EShortcut::SPELLBOOK_TAB_ADVENTURE:
|
||||||
fadvSpellsb();
|
fadvSpellsb();
|
||||||
break;
|
break;
|
||||||
|
case EShortcut::SPELLBOOK_SEARCH_FOCUS:
|
||||||
|
toggleSearchBoxFocus();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ public:
|
|||||||
void fexitb();
|
void fexitb();
|
||||||
void fadvSpellsb();
|
void fadvSpellsb();
|
||||||
void fbattleSpellsb();
|
void fbattleSpellsb();
|
||||||
|
void toggleSearchBoxFocus();
|
||||||
void fmanaPtsb();
|
void fmanaPtsb();
|
||||||
|
|
||||||
void fLcornerb();
|
void fLcornerb();
|
||||||
|
|||||||
@@ -233,6 +233,7 @@
|
|||||||
"spectateTrackHero": [],
|
"spectateTrackHero": [],
|
||||||
"spellbookTabAdventure": "A",
|
"spellbookTabAdventure": "A",
|
||||||
"spellbookTabCombat": "C",
|
"spellbookTabCombat": "C",
|
||||||
|
"spellbookSearchFocus": "Tab",
|
||||||
"townOpenFort": "F",
|
"townOpenFort": "F",
|
||||||
"townOpenGarrisonedHero": "Shift+H",
|
"townOpenGarrisonedHero": "Shift+H",
|
||||||
"townOpenHall": "B",
|
"townOpenHall": "B",
|
||||||
|
|||||||
Reference in New Issue
Block a user