1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

extend for all selections

This commit is contained in:
Laserlicht 2023-09-14 12:26:11 +02:00
parent 03316c62bf
commit 39838fdd3c
2 changed files with 8 additions and 0 deletions

View File

@ -106,6 +106,7 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl
addChild(comps[i].get());
components.push_back(comps[i]);
comps[i]->onSelect = std::bind(&CSelWindow::selectionChange,this,i);
comps[i]->onChoose = std::bind(&CSelWindow::madeChoiceAndClose,this);
if(i<8)
comps[i]->assignedKey = vstd::next(EShortcut::SELECT_INDEX_1,i);
}
@ -127,6 +128,12 @@ void CSelWindow::madeChoice()
LOCPLINT->cb->selectionMade(ret+1,ID);
}
void CSelWindow::madeChoiceAndClose()
{
madeChoice();
close();
}
CInfoWindow::CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo & comps, const TButtonsInfo & Buttons)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);

View File

@ -130,6 +130,7 @@ class CSelWindow : public CInfoWindow
public:
void selectionChange(unsigned to);
void madeChoice(); //looks for selected component and calls callback
void madeChoiceAndClose();
CSelWindow(const std::string & text, PlayerColor player, int charperline, const std::vector<std::shared_ptr<CSelectableComponent>> & comps, const std::vector<std::pair<AnimationPath,CFunctionList<void()> > > &Buttons, QueryID askID);
//notification - this class inherits important destructor from CInfoWindow