mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
using CHeroArea
This commit is contained in:
@@ -121,9 +121,10 @@ void LRClickableAreaWTextComp::showPopupWindow(const Point & cursorPosition)
|
||||
}
|
||||
|
||||
CHeroArea::CHeroArea(int x, int y, const CGHeroInstance * hero)
|
||||
: CIntObject(LCLICK | HOVER),
|
||||
: CIntObject(LCLICK | SHOW_POPUP | HOVER),
|
||||
hero(hero),
|
||||
clickFunctor(nullptr)
|
||||
clickFunctor(nullptr),
|
||||
clickRFunctor(nullptr)
|
||||
{
|
||||
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
||||
|
||||
@@ -147,12 +148,23 @@ void CHeroArea::addClickCallback(ClickFunctor callback)
|
||||
clickFunctor = callback;
|
||||
}
|
||||
|
||||
void CHeroArea::addRClickCallback(ClickFunctor callback)
|
||||
{
|
||||
clickRFunctor = callback;
|
||||
}
|
||||
|
||||
void CHeroArea::clickPressed(const Point & cursorPosition)
|
||||
{
|
||||
if(clickFunctor)
|
||||
clickFunctor();
|
||||
}
|
||||
|
||||
void CHeroArea::showPopupWindow(const Point & cursorPosition)
|
||||
{
|
||||
if(clickRFunctor)
|
||||
clickRFunctor();
|
||||
}
|
||||
|
||||
void CHeroArea::hover(bool on)
|
||||
{
|
||||
if (on && hero)
|
||||
|
||||
Reference in New Issue
Block a user