Added support for onEnter/onExit to the scrolling lists.

This commit is contained in:
Pieter Hulshoff 2016-06-10 18:30:14 +02:00
parent e711049acb
commit 0c2b2e56f2
3 changed files with 29 additions and 1 deletions

View File

@ -51,7 +51,7 @@ ScrollingList::ScrollingList(Configuration &c,
, spriteList_(NULL)
, scrollPoints_(NULL)
, tweenPoints_(NULL)
, focus_(true)
, focus_(false)
, itemIndex_(0)
, componentIndex_(0)
, selectedOffsetIndex_(0)
@ -381,6 +381,30 @@ void ScrollingList::freeGraphicsMemory()
deallocateSpritePoints();
}
void ScrollingList::triggerEnterEvent()
{
focus_ = true;
notifyAllRequested_ = true;
for(unsigned int i = 0; i < components_.size(); ++i)
{
Component *c = components_.at(i);
if(c) c->triggerEvent( "enter" );
}
}
void ScrollingList::triggerExitEvent()
{
focus_ = false;
notifyAllRequested_ = true;
for(unsigned int i = 0; i < components_.size(); ++i)
{
Component *c = components_.at(i);
if(c) c->triggerEvent( "exit" );
}
}
void ScrollingList::triggerMenuEnterEvent( int menuIndex )
{
focus_ = true;

View File

@ -53,6 +53,8 @@ public:
ScrollingList(const ScrollingList &copy);
virtual ~ScrollingList();
void triggerEnterEvent();
void triggerExitEvent();
void triggerMenuEnterEvent(int menuIndex = -1);
void triggerMenuExitEvent(int menuIndex = -1);

View File

@ -235,6 +235,7 @@ void Page::start()
{
ScrollingList *menu = *it;
menu->triggerEvent( "enter" );
menu->triggerEnterEvent();
}
if(loadSoundChunk_)
@ -263,6 +264,7 @@ void Page::stop()
{
ScrollingList *menu = *it;
menu->triggerEvent( "exit" );
menu->triggerExitEvent();
}
if(unloadSoundChunk_)