javauis/m2g_qt/src/jni/M2GSVGSVGElement.cpp
changeset 56 abc41079b313
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/m2g_qt/src/jni/M2GSVGSVGElement.cpp	Fri Jul 23 12:27:20 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2005-2006 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:  JNI methods
+*
+*/
+
+// INCLUDE FILES
+#include "CM2GEventSource.h"
+#include "com_nokia_microedition_m2g_M2GSVGSVGElement.h"
+#include "MM2GSVGProxy.h"
+
+M2G_NS_START
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+// ================================ FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_getMediaTime
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::GetMediaTimeL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @param aSeconds Media time to be returned.
+ */
+JNIEXPORT jfloat JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1getMediaTime(
+    JNIEnv* aJni,
+    jclass,
+    jint aSvgProxyHandle,
+    jint aDocumentHandle)
+{
+    M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _getMediaTime - begin");
+    TReal32 seconds = 0;
+    TInt err = KM2GNotOk;
+    
+    M2G_DO_LOCK
+    if (aSvgProxyHandle)
+        {
+        MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+        TRAP(err, aProxy->GetMediaTimeL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),seconds); );
+        }
+    M2G_DO_UNLOCK(aJni)
+
+    M2GGeneral::CheckErrorCode(aJni, err);
+ 
+    M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _getMediaTime: %f - end", seconds);
+    return STATIC_CAST(jfloat, seconds);
+}
+
+
+// -----------------------------------------------------------------------------
+// Java_com_nokia_microedition_m2g_M2GSVGImage::_setMediaTime
+// -----------------------------------------------------------------------------
+/**
+ * Calls MM2GSVGProxy::SetMediaTimeL method.
+ * @since Series S60 3.0
+ * @param aProxy Proxy instance.
+ * @param aDocumentHandle Document handle
+ * @param aSeconds Media time
+ */
+JNIEXPORT void JNICALL
+Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1setMediaTime(
+    JNIEnv* aJni,
+    jclass,
+    jint aSvgProxyHandle,
+    jint aDocumentHandle,
+    jfloat aSeconds
+)
+{
+    M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _setMediaTime - begin");
+    TInt err = KM2GNotOk;
+    
+    TReal32* lseconds = REINTERPRET_CAST(TReal32*, &aSeconds);
+    
+    M2G_DO_LOCK
+    if (aSvgProxyHandle)
+        {
+        MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
+        TRAP(err, aProxy->SetMediaTimeL(
+                STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
+                *lseconds); );
+        }
+    M2G_DO_UNLOCK(aJni)
+    
+    M2GGeneral::CheckErrorCode(aJni, err);
+
+    M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _setMediaTime: %f - end", aSeconds);
+}