UMD.HCIL.Piccolo.PNode.HandleEvent C# (CSharp) Method

HandleEvent() protected method

Raise the given input event.
If an event has been set as handled, and the delegate is not a member of a listener class, then the event is consumed. If the delegate is a member of a listener class the decision of consumption is left up to the filter associated with that class.
protected HandleEvent ( PInputEventArgs e, PInputEventHandler handler ) : void
e UMD.HCIL.Piccolo.Event.PInputEventArgs The arguments for this input event.
handler PInputEventHandler The delegate to dispatch this event to.
return void
		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);
					}
				}
			}
		}