diff -r 023eef975703 -r abc41079b313 javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GEvent.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GEvent.java Fri Jul 23 12:27:20 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.microedition.m2g; + +import org.w3c.dom.events.*; +import org.w3c.dom.svg.SVGElement; + +/** + * The Event interface is used to provide contextual information about an event to the handler + * processing the event. An object which implements the Event interface is passed as the first + * parameter to the {@link org.w3c.dom.events.EventListener#handleEvent handleEvent} call. + */ +public class M2GEvent implements Event +{ + public static final boolean EVENT_TARGET = false; + public static final boolean WRAPPED_EVENT_TARGET = true; + //-------------------------------------------------- + // VARIABLES + //-------------------------------------------------- + private String iEventType; + private EventTarget iTarget; + private boolean iWrappedTarget; + + //-------------------------------------------------- + // METHODS + //-------------------------------------------------- + /** + * Constructor + * @param aEventType Type + * @param aTarget Target + * @param aWrappedTarget If WRAPPED_EVENT_TARGET then getCurrentTarget + * method returns a wrapped event target (which base class is NOT Node. + * Otherwise normal event target (which base class is Node) is returned. + */ + public M2GEvent(String aEventType, EventTarget aTarget, boolean aWrappedTarget) + { + iEventType = aEventType; + iTarget = aTarget; + iWrappedTarget = aWrappedTarget; + } + + /** + * @see org.w3c.dom.events.Event#getCurrentTarget() + * @see M2GEvent() + */ + public EventTarget getCurrentTarget() + { + if (iWrappedTarget) + { + if ((iTarget != null) && (iTarget instanceof M2GSVGElement)) + { + return new M2GSVGElementWrapper((M2GSVGElement)iTarget); + } + return null; + } + return iTarget; + } + + /** + * @see org.w3c.dom.events.Event#getType() + */ + public String getType() + { + return iEventType; + } +}