openframeworks/openFrameworks — pull request #2015 by arturoc (2013-04-11 09:33:37+00:00)
Title: mark events as attended

this adds the posibility of declaring an event listener as:

bool mousePressed(ofMouseEventArgs & mouse){
if(....){
return true;
}else{
return false;
}
}

returning true will mark the event as attended and won't be passed to any other listener.

It also adds the possibility of adding a listener with priority so you can control the order in which listeners are called. And there's 3 default priorities:

OF_EVENT_ORDER_BEFORE_APP=0,
OF_EVENT_ORDER_APP=100,
OF_EVENT_ORDER_AFTER_APP=200

old event listeners that don't specify priority are added as AFTER_APP, and other priorities can be specified using numbers:

ofAddListener(event,this,&MyClass::listener,priority);