protected virtual void HandleEvent(PInputEventArgs e, PInputEventHandler handler) {
if (handler != null) {
Delegate[] list = handler.GetInvocationList();
for (int i = list.Length - 1; i >= 0; i--) {
Delegate each = list[i];
if (each.Target is PInputEventListener) {
PInputEventListener listener = (PInputEventListener)each.Target;
if (listener.DoesAcceptEvent(e)) {
// The source is the node from which the event originated, not the
// picked node.
((PInputEventHandler)each)(this, e);
}
}
else if (!e.Handled) {
// The source is the node from which the event originated, not the
// picked node.
((PInputEventHandler)each)(this, e);
}
}
}
}