|
NAMEPrima::EventHook - event filteringSYNOPSISuse Prima::EventHook; sub hook { my ( $my_param, $object, $event, @params) = @_; ... print "Object $object received event $event\n"; ... return 1; } Prima::EventHook::install( \&hook, param => $my_param, object => $my_window, event => [qw(Size Move Destroy)], children => 1 ); Prima::EventHook::deinstall(\&hook); DESCRIPTIONPrima dispatches events by calling notifications registered on one or more objects interested in the events. Also, one event hook can be installed that would receive all events occurred on all objects. "Prima::EventHook" provides multiplex access to the core event hook and introduces set of dispatching rules so the user hook subs receive only a defined subset of events.The filtering criteria are event names and object hierarchy. APIinstall SUB, %RULESInstalls SUB into hook list using hash of RULES.The SUB is called with variable list of parameters, formed so first passed parameters from 'param' key ( see below ), then event source object, then event name, and finally parameters to the event. SUB must return an integer, either 0 or 1, to block or pass the event, respectively. If 1 is returned, other hook subs are called; if 0 is returned, the event is efficiently blocked and no hooks are further called. Rules can contain the following keys:
deinstall SUBRemoves the hook sub for the hook list.NOTES"Prima::EventHook" by default automatically starts and stops Prima event hook mechanism when appropriate. If it is not desired, for example for your own event hook management, set $auto_hook to 0.AUTHORDmitry Karasik, <dmitry@karasik.eu.org>.SEE ALSOPrima, Prima::Object
Visit the GSP FreeBSD Man Page Interface. |