javauis/m2g_akn/src/jni/M2GSVGElement.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  JNI methods
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "CM2GEventSource.h"
       
    20 #include "com_nokia_microedition_m2g_M2GSVGElement.h"
       
    21 #include "MM2GSVGProxy.h"
       
    22 #include <methodwrappers.h>
       
    23 
       
    24 M2G_NS_START
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // LOCAL CONSTANTS AND MACROS
       
    35 
       
    36 // MODULE DATA STRUCTURES
       
    37 
       
    38 // LOCAL FUNCTION PROTOTYPES
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 // ================================ FUNCTIONS ==================================
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // Java_com_nokia_microedition_m2g_M2GSVGElement::_appendChild
       
    48 // -----------------------------------------------------------------------------
       
    49 /**
       
    50  * Calls MM2GSVGProxy::AppendChildL method.
       
    51  * @since Series S60 3.0
       
    52  * @param aProxy Proxy instance.
       
    53  * @param aElementHandle Element handle
       
    54  * @param aChildElementHandle Child handle
       
    55  */
       
    56 LOCAL_C void DoAppendChildL(
       
    57     MM2GSVGProxy* aProxy,
       
    58     TInt aElementHandle,
       
    59     TInt aChildElementHandle)
       
    60 {
       
    61     aProxy->AppendChildL(
       
    62         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
    63         STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle));
       
    64 }
       
    65 /**
       
    66  * JNI method
       
    67  */
       
    68 JNIEXPORT void JNICALL
       
    69 Java_com_nokia_microedition_m2g_M2GSVGElement__1appendChild(
       
    70     JNIEnv* aJni,
       
    71     jclass,
       
    72     jint aEventSourceHandle,
       
    73     jint aSvgProxyHandle,
       
    74     jint aElementHandle,
       
    75     jint aChildElementHandle,
       
    76     jboolean aUiToolkit)
       
    77 {
       
    78     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - begin");
       
    79     TInt err = KM2GNotOk;
       
    80     if (aUiToolkit)  // If eSWT is the current toolkit
       
    81     {
       
    82         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
    83         if (client && aSvgProxyHandle)
       
    84         {
       
    85             typedef void (MM2GSVGProxy::*pAppendChildL)(const TM2GSvgElementHandle& ,const TM2GSvgElementHandle&);
       
    86             pAppendChildL AppendChildL = &MM2GSVGProxy::AppendChildL;
       
    87             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
    88             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
    89             TM2GSvgElementHandle lChildElementHandle = STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle);
       
    90             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgElementHandle&, const TM2GSvgElementHandle&> DoAppendChild(
       
    91                 *aProxy,
       
    92                 AppendChildL,
       
    93                 lElementHandle,
       
    94                 lChildElementHandle);
       
    95             err = client->Execute(DoAppendChild);
       
    96         }
       
    97     }
       
    98     else
       
    99     {
       
   100         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   101         if (eventSource && aSvgProxyHandle)
       
   102         {
       
   103             err = eventSource->ExecuteTrap(
       
   104                       &DoAppendChildL,
       
   105                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   106                       aElementHandle,
       
   107                       aChildElementHandle);
       
   108         }
       
   109     }
       
   110     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - end");
       
   111     M2GGeneral::CheckErrorCode(aJni, err);
       
   112 }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // Java_com_nokia_microedition_m2g_M2GSVGElement::_checkRemoveable
       
   116 // -----------------------------------------------------------------------------
       
   117 /**
       
   118  * Calls MM2GSVGProxy::CheckRemoveableL method.
       
   119  * @since Series S60 3.0
       
   120  * @param aProxy Proxy instance.
       
   121  * @param aElementHandle Element handle
       
   122  * @param aRemoveable Result
       
   123  */
       
   124 LOCAL_C void DoCheckRemoveableL(
       
   125     MM2GSVGProxy* aProxy,
       
   126     TInt aElementHandle,
       
   127     TInt* aRemoveable)
       
   128 {
       
   129     aProxy->CheckRemoveableL(aElementHandle, *aRemoveable);
       
   130 }
       
   131 
       
   132 /**
       
   133  * JNI method.
       
   134  */
       
   135 JNIEXPORT jint JNICALL Java_com_nokia_microedition_m2g_M2GSVGElement__1checkRemoveable(
       
   136     JNIEnv* aJni,
       
   137     jclass,
       
   138     jint aEventSourceHandle,
       
   139     jint aSvgProxyHandle,
       
   140     jint aElementHandle,
       
   141     jboolean aUiToolkit)
       
   142 {
       
   143     TInt removeable = -1;
       
   144     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable - begin");
       
   145     TInt err = KM2GNotOk;
       
   146     if (aUiToolkit)  // If eSWT is the current toolkit
       
   147     {
       
   148         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   149         if (client && aSvgProxyHandle)
       
   150         {
       
   151             typedef void (MM2GSVGProxy::*pCheckRemoveableL)(const TM2GSvgElementHandle& ,TInt&);
       
   152             pCheckRemoveableL CheckRemoveableL = &MM2GSVGProxy::CheckRemoveableL;
       
   153             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   154             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgElementHandle&, TInt&> DoCheckRemoveable(
       
   155                 *aProxy,
       
   156                 CheckRemoveableL,
       
   157                 aElementHandle,
       
   158                 removeable);
       
   159             err = client->Execute(DoCheckRemoveable);
       
   160         }
       
   161     }
       
   162     else
       
   163     {
       
   164         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   165         if (eventSource && aSvgProxyHandle)
       
   166         {
       
   167             err = eventSource->ExecuteTrap(
       
   168                       &DoCheckRemoveableL,
       
   169                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   170                       aElementHandle,
       
   171                       &removeable);
       
   172         }
       
   173     }
       
   174     M2GGeneral::CheckErrorCode(aJni, err);
       
   175     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable: %d - end", removeable);
       
   176     return removeable;
       
   177 }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getBBox
       
   181 // -----------------------------------------------------------------------------
       
   182 /**
       
   183  * Calls MM2GSVGProxy::GetBBoxL method.
       
   184  * @since Series S60 3.0
       
   185  * @param aProxy Proxy instance.
       
   186  * @param aElementHandle Element handle
       
   187  * @param aAttributeTypeId Attribute type id
       
   188  * @param aRectData Returns rect components
       
   189  * @param aResult Result "0" ok
       
   190  */
       
   191 LOCAL_C void DoGetBBoxL(
       
   192     MM2GSVGProxy* aProxy,
       
   193     TInt aElementHandle,
       
   194     TInt16 aAttributeTypeId,
       
   195     TM2GRectData* aRectData,
       
   196     TInt* aResult)
       
   197 {
       
   198     aProxy->GetBBoxL(
       
   199         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   200         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   201         *aRectData, *aResult);
       
   202 }
       
   203 /**
       
   204  * JNI method
       
   205  */
       
   206 JNIEXPORT jint JNICALL
       
   207 Java_com_nokia_microedition_m2g_M2GSVGElement__1getBBox(
       
   208     JNIEnv* aJni,
       
   209     jclass,
       
   210     jint aEventSourceHandle,
       
   211     jint aSvgProxyHandle,
       
   212     jint aElementHandle,
       
   213     jshort aAttributeTypeId,
       
   214     jfloatArray aRectComponents,
       
   215     jboolean aUiToolkit)
       
   216 {
       
   217     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox - begin");
       
   218 
       
   219     TM2GRectData rect;
       
   220     TInt result = 0;
       
   221     TInt err = KM2GNotOk;
       
   222     if (aUiToolkit)  // If eSWT is the current toolkit
       
   223     {
       
   224         MSwtClient* client = reinterpret_cast< MSwtClient*  >(aEventSourceHandle);
       
   225         if (client && aSvgProxyHandle)
       
   226         {
       
   227             typedef void (MM2GSVGProxy::*pGetBBoxL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GRectData& , TInt&);
       
   228             pGetBBoxL GetBBoxL = &MM2GSVGProxy::GetBBoxL;
       
   229             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   230             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
   231             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
   232             TMethodWrapper4<MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GRectData& , TInt&> DoGetBBox(
       
   233                 *aProxy,
       
   234                 GetBBoxL,
       
   235                 lElementHandle,
       
   236                 lAttrType,
       
   237                 rect,
       
   238                 result);
       
   239             err = client->Execute(DoGetBBox);
       
   240         }
       
   241     }
       
   242     else
       
   243     {
       
   244         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   245         if (eventSource && aSvgProxyHandle)
       
   246         {
       
   247             err = eventSource->ExecuteTrap(
       
   248                       &DoGetBBoxL,
       
   249                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   250                       aElementHandle,
       
   251                       aAttributeTypeId,
       
   252                       &rect, &result);
       
   253 
       
   254         }
       
   255     }
       
   256     M2GGeneral::CheckErrorCode(aJni, err);
       
   257 
       
   258     aJni->SetFloatArrayRegion(
       
   259         REINTERPRET_CAST(jfloatArray, aRectComponents),
       
   260         0,
       
   261         rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
       
   262 
       
   263     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox: %d - end", result);
       
   264     return result;
       
   265 }
       
   266 
       
   267 // -----------------------------------------------------------------------------
       
   268 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getColorTrait
       
   269 // -----------------------------------------------------------------------------
       
   270 /**
       
   271  * Calls MM2GSVGProxy::GetColorTraitL method.
       
   272  * @since Series S60 3.0
       
   273  * @param aProxy Proxy instance.
       
   274  * @param aElementHandle Element handle
       
   275  * @param aAttributeTypeId Attribute type id
       
   276  * @param aColors Color elements ( RGB )
       
   277  * @param aTrait Result
       
   278  */
       
   279 LOCAL_C void DoGetColorTraitL(
       
   280     MM2GSVGProxy* aProxy,
       
   281     TInt aElementHandle,
       
   282     TInt16 aAttributeTypeId,
       
   283     TM2GColorData* aColor,
       
   284     TInt* aResult)
       
   285 {
       
   286     aProxy->GetColorTraitL(
       
   287         aElementHandle,
       
   288         aAttributeTypeId,
       
   289         *aColor,
       
   290         *aResult);
       
   291 }
       
   292 
       
   293 /**
       
   294  * JNI method
       
   295  */
       
   296 JNIEXPORT jint JNICALL
       
   297 Java_com_nokia_microedition_m2g_M2GSVGElement__1getColorTrait(
       
   298     JNIEnv* aJni,
       
   299     jclass,
       
   300     jint aEventSourceHandle,
       
   301     jint aSvgProxyHandle,
       
   302     jint aElementHandle,
       
   303     jshort aAttributeTypeId,
       
   304     jintArray aColorComponents,
       
   305     jboolean aUiToolkit)
       
   306 {
       
   307     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait - begin");
       
   308     TM2GColorData color;
       
   309     TInt result = -1;
       
   310     TInt err = KM2GNotOk;
       
   311     if (aUiToolkit)  // If eSWT is the current toolkit
       
   312     {
       
   313         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   314         if (client && aSvgProxyHandle)
       
   315         {
       
   316             typedef void (MM2GSVGProxy::*pGetColorTraitL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GColorData& , TInt&);
       
   317             pGetColorTraitL GetColorTraitL = &MM2GSVGProxy::GetColorTraitL;
       
   318             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   319             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
   320             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
   321             TMethodWrapper4<MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GColorData& , TInt&   > GetColorTrait(
       
   322                 *aProxy,
       
   323                 GetColorTraitL,
       
   324                 lElementHandle,
       
   325                 lAttrType,
       
   326                 color,
       
   327                 result);
       
   328             err = client->Execute(GetColorTrait);
       
   329         }
       
   330     }
       
   331     else
       
   332     {
       
   333         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   334         if (eventSource && aSvgProxyHandle)
       
   335         {
       
   336             err = eventSource->ExecuteTrap(
       
   337                       &DoGetColorTraitL,
       
   338                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   339                       aElementHandle,
       
   340                       aAttributeTypeId,
       
   341                       &color, &result);
       
   342         }
       
   343     }
       
   344     M2GGeneral::CheckErrorCode(aJni, err);
       
   345     if (color[ 0 ] == -1 && color[ 1 ] == -1 && color[ 2 ] == -1)
       
   346     {
       
   347         result = 0;
       
   348         aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), &(color[ 0 ]));
       
   349     }
       
   350     else if (result != -1)
       
   351     {
       
   352         result = 1;
       
   353         aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(),  color.Begin());
       
   354     }
       
   355 
       
   356     M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait: %d, R=%d, G=%d, B=%d - end", result, color[ 0 ], color[ 1 ], color[ 2 ]);
       
   357     return result;
       
   358 }
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getElementTypeId
       
   362 // -----------------------------------------------------------------------------
       
   363 /**
       
   364  * Calls MM2GSVGProxy::GetElementTypeIdL method.
       
   365  * @since Series S60 3.0
       
   366  * @param aProxy Proxy instance.
       
   367  * @param aElementHandle Element handle
       
   368  * @param aId
       
   369  */
       
   370 LOCAL_C void DoGetElementTypeIdL(
       
   371     MM2GSVGProxy* aProxy,
       
   372     TInt aElementHandle,
       
   373     TInt16* aId)
       
   374 {
       
   375     aProxy->GetElementTypeIdL(aElementHandle, *aId);
       
   376 }
       
   377 
       
   378 /**
       
   379  * JNI method
       
   380  */
       
   381 JNIEXPORT jshort JNICALL
       
   382 Java_com_nokia_microedition_m2g_M2GSVGElement__1getElementTypeId(
       
   383     JNIEnv* aJni,
       
   384     jclass,
       
   385     jint aEventSourceHandle,
       
   386     jint aSvgProxyHandle,
       
   387     jint aElementHandle,
       
   388     jboolean aUiToolkit)
       
   389 {
       
   390     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId - begin");
       
   391     TInt16 id = 0;
       
   392     TInt err = KM2GNotOk;
       
   393     if (aUiToolkit)  // If eSWT is the current toolkit
       
   394     {
       
   395         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   396         if (client && aSvgProxyHandle)
       
   397         {
       
   398             typedef void (MM2GSVGProxy::*pGetElementTypeIdL)(const TM2GSvgElementHandle& , TInt16&);
       
   399             pGetElementTypeIdL GetElementTypeIdL = &MM2GSVGProxy::GetElementTypeIdL;
       
   400             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   401             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
   402             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgElementHandle& , TInt16&   > GetElementTypeId(
       
   403                 *aProxy,
       
   404                 GetElementTypeIdL,
       
   405                 lElementHandle,
       
   406                 id);
       
   407             err = client->Execute(GetElementTypeId);
       
   408         }
       
   409     }
       
   410     else
       
   411     {
       
   412         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   413         if (eventSource && aSvgProxyHandle)
       
   414         {
       
   415             err = eventSource->ExecuteTrap(
       
   416                       &DoGetElementTypeIdL,
       
   417                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   418                       aElementHandle,
       
   419                       &id);
       
   420 
       
   421         }
       
   422     }
       
   423     M2GGeneral::CheckErrorCode(aJni, err);
       
   424     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId: %d - end", id);
       
   425     return id;
       
   426 }
       
   427 
       
   428 // -----------------------------------------------------------------------------
       
   429 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getEnumTrait
       
   430 // -----------------------------------------------------------------------------
       
   431 /**
       
   432  * Calls MM2GSVGProxy::GetEnumTraitL method.
       
   433  * @since Series S60 3.0
       
   434  * @param aProxy Proxy instance.
       
   435  * @param aElementHandle Element handle
       
   436  * @param aAttributeTypeId Attribute type id
       
   437  * @param aEnumTrait The enumeration value of the specified attribute
       
   438  */
       
   439 LOCAL_C void DoGetEnumTraitL(
       
   440     MM2GSVGProxy* aProxy,
       
   441     TInt aElementHandle,
       
   442     TInt16 aAttributeTypeId,
       
   443     TInt16* aEnumTrait)
       
   444 {
       
   445     aProxy->GetEnumTraitL(
       
   446         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   447         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   448         *aEnumTrait);
       
   449 }
       
   450 
       
   451 /**
       
   452  * JNI method
       
   453  */
       
   454 JNIEXPORT jshort JNICALL
       
   455 Java_com_nokia_microedition_m2g_M2GSVGElement__1getEnumTrait(
       
   456     JNIEnv* aJni,
       
   457     jclass,
       
   458     jint aEventSourceHandle,
       
   459     jint aSvgProxyHandle,
       
   460     jint aElementHandle,
       
   461     jshort aAttributeTypeId,
       
   462     jboolean aUiToolkit)
       
   463 {
       
   464     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait - begin");
       
   465     TInt16 enumTrait = 0;
       
   466     TInt err = KM2GNotOk;
       
   467     if (aUiToolkit)  // If eSWT is the current toolkit
       
   468     {
       
   469         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   470         if (client && aSvgProxyHandle)
       
   471         {
       
   472             typedef void (MM2GSVGProxy::*pGetEnumTraitL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TInt16&);
       
   473             pGetEnumTraitL GetEnumTraitL = &MM2GSVGProxy::GetEnumTraitL;
       
   474             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   475             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
   476             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
   477             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TInt16&   > GetEnumTrait(
       
   478                 *aProxy,
       
   479                 GetEnumTraitL,
       
   480                 lElementHandle,lAttrType,enumTrait);
       
   481             err = client->Execute(GetEnumTrait);
       
   482         }
       
   483     }
       
   484     else
       
   485     {
       
   486         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   487         if (eventSource && aSvgProxyHandle)
       
   488         {
       
   489             err = eventSource->ExecuteTrap(
       
   490                       &DoGetEnumTraitL,
       
   491                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   492                       aElementHandle,
       
   493                       STATIC_CAST(TInt16, aAttributeTypeId),
       
   494                       &enumTrait);
       
   495         }
       
   496     }
       
   497     M2GGeneral::CheckErrorCode(aJni, err);
       
   498     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait: %d - end", enumTrait);
       
   499     return enumTrait;
       
   500 }
       
   501 
       
   502 // -----------------------------------------------------------------------------
       
   503 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getFirstElementChild
       
   504 // -----------------------------------------------------------------------------
       
   505 /**
       
   506  * Calls MM2GSVGProxy::GetFirstElementChildL method.
       
   507  * @since Series S60 3.0
       
   508  * @param aProxy Proxy instance.
       
   509  * @param aElementHandle Element handle
       
   510  * @param aHandle Element handle to be returned.
       
   511  */
       
   512 LOCAL_C void DoGetFirstElementChildL(
       
   513     MM2GSVGProxy* aProxy,
       
   514     TInt aElementHandle,
       
   515     TInt* aChildHandle)
       
   516 {
       
   517     aProxy->GetFirstElementChildL(aElementHandle, *aChildHandle);
       
   518 }
       
   519 
       
   520 /**
       
   521  * JNI method
       
   522  */
       
   523 JNIEXPORT jint JNICALL
       
   524 Java_com_nokia_microedition_m2g_M2GSVGElement__1getFirstElementChild(
       
   525     JNIEnv* aJni,
       
   526     jclass,
       
   527     jint aEventSourceHandle,
       
   528     jint aSvgProxyHandle,
       
   529     jint aElementHandle,
       
   530     jboolean aUiToolkit)
       
   531 {
       
   532     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild - begin");
       
   533 
       
   534     TInt childHandle = M2G_INVALID_HANDLE;
       
   535     TInt err = KM2GNotOk;
       
   536     if (aUiToolkit)  // If eSWT is the current toolkit
       
   537     {
       
   538         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   539         if (client && aSvgProxyHandle)
       
   540         {
       
   541             typedef void (MM2GSVGProxy::*pGetFirstElementChildL)(const TInt& ,TInt&);
       
   542             pGetFirstElementChildL GetFirstElementChildL = &MM2GSVGProxy::GetFirstElementChildL;
       
   543             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   544             TMethodWrapper2<MM2GSVGProxy, const TInt& ,TInt& > GetFirstElementChild(
       
   545                 *aProxy,
       
   546                 GetFirstElementChildL,
       
   547                 aElementHandle,
       
   548                 childHandle);
       
   549             err = client->Execute(GetFirstElementChild);
       
   550         }
       
   551     }
       
   552     else
       
   553     {
       
   554         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   555         if (eventSource && aSvgProxyHandle)
       
   556         {
       
   557             err = eventSource->ExecuteTrap(
       
   558                       &DoGetFirstElementChildL,
       
   559                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   560                       aElementHandle,
       
   561                       &childHandle);
       
   562 
       
   563         }
       
   564     }
       
   565     M2GGeneral::CheckErrorCode(aJni, err);
       
   566     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild: %d - end", childHandle);
       
   567     return childHandle;
       
   568 }
       
   569 
       
   570 // -----------------------------------------------------------------------------
       
   571 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getFloatTrait
       
   572 // -----------------------------------------------------------------------------
       
   573 /**
       
   574  * Calls MM2GSVGProxy::GetFloatTraitL method.
       
   575  * @since Series S60 3.0
       
   576  * @param aProxy Proxy instance.
       
   577  * @param aElementHandle Element handle
       
   578  * @param aAttributeTypeId Attribute type id
       
   579  * @param aFloatTrait Float attribute to be returned
       
   580  */
       
   581 LOCAL_C void DoGetFloatTraitL(
       
   582     MM2GSVGProxy* aProxy,
       
   583     TInt aElementHandle,
       
   584     TInt16 aAttributeTypeId,
       
   585     TReal32* aFloatTrait)
       
   586 {
       
   587     aProxy->GetFloatTraitL(
       
   588         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   589         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   590         *aFloatTrait);
       
   591 }
       
   592 
       
   593 /**
       
   594  * JNI method
       
   595  */
       
   596 JNIEXPORT jfloat JNICALL
       
   597 Java_com_nokia_microedition_m2g_M2GSVGElement__1getFloatTrait(
       
   598     JNIEnv* aJni,
       
   599     jclass,
       
   600     jint aEventSourceHandle,
       
   601     jint aSvgProxyHandle,
       
   602     jint aElementHandle,
       
   603     jshort aAttributeTypeId,
       
   604     jboolean aUiToolkit)
       
   605 {
       
   606     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait - begin");
       
   607     TInt err = KM2GNotOk;
       
   608     TReal32 floatTrait = 0;
       
   609     if (aUiToolkit)  // If eSWT is the current toolkit
       
   610     {
       
   611         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   612         if (client && aSvgProxyHandle)
       
   613         {
       
   614             typedef void (MM2GSVGProxy::*pGetFloatTraitL)(const TM2GSvgElementHandle&, const TM2GSvgAttrType& ,TReal32&);
       
   615             pGetFloatTraitL GetFloatTraitL = &MM2GSVGProxy::GetFloatTraitL;
       
   616             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   617             // TM2GSvgElementHandle lElementHandle = STATIC_CAST( TM2GSvgElementHandle, aElementHandle );
       
   618             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
   619             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&, const TM2GSvgAttrType& ,TReal32&  > GetFloatTrait(
       
   620                 *aProxy,
       
   621                 GetFloatTraitL,
       
   622                 aElementHandle,
       
   623                 lAttrType,
       
   624                 floatTrait);
       
   625             err = client->Execute(GetFloatTrait);
       
   626         }
       
   627     }
       
   628     else
       
   629     {
       
   630         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   631 
       
   632         if (eventSource && aSvgProxyHandle)
       
   633         {
       
   634             err = eventSource->ExecuteTrap(
       
   635                       &DoGetFloatTraitL,
       
   636                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   637                       aElementHandle,
       
   638                       aAttributeTypeId,
       
   639                       &floatTrait);
       
   640 
       
   641         }
       
   642     }
       
   643     M2GGeneral::CheckErrorCode(aJni, err);
       
   644     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait: %f - end", floatTrait);
       
   645     return STATIC_CAST(jfloat, floatTrait);
       
   646 }
       
   647 
       
   648 // -----------------------------------------------------------------------------
       
   649 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getMatrixTrait
       
   650 // -----------------------------------------------------------------------------
       
   651 /**
       
   652  * Calls MM2GSVGProxy::GetMatrixTraitL method.
       
   653  * @since Series S60 3.0
       
   654  * @param aProxy Proxy instance.
       
   655  * @param aElementHandle Element handle
       
   656  * @param aAttributeTypeId Attribute type id
       
   657  * @param aResult Result: "0" if ok and "-1" if nok
       
   658  */
       
   659 LOCAL_C void DoGetMatrixTraitL(
       
   660     MM2GSVGProxy* aProxy,
       
   661     TInt aElementHandle,
       
   662     TInt16 aAttributeTypeId,
       
   663     TM2GMatrixData* aMatrixData,
       
   664     TInt* aResult)
       
   665 {
       
   666     aProxy->GetMatrixTraitL(
       
   667         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   668         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   669         *aMatrixData, *aResult);
       
   670 }
       
   671 
       
   672 /**
       
   673  * JNI method
       
   674  */
       
   675 JNIEXPORT jint JNICALL
       
   676 Java_com_nokia_microedition_m2g_M2GSVGElement__1getMatrixTrait(
       
   677     JNIEnv* aJni,
       
   678     jclass,
       
   679     jint aEventSourceHandle,
       
   680     jint aSvgProxyHandle,
       
   681     jint aElementHandle,
       
   682     jshort aAttributeTypeId,
       
   683     jfloatArray aMatrixComponents,
       
   684     jboolean aUiToolKit)
       
   685 {
       
   686     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait - begin");
       
   687     TM2GMatrixData matrix;
       
   688     TInt result = -1;
       
   689     TInt err = KM2GNotOk;
       
   690     if (aUiToolKit)  // If eSWT is the current toolkit
       
   691     {
       
   692         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   693         if (client && aSvgProxyHandle)
       
   694         {
       
   695             typedef void (MM2GSVGProxy::*pGetMatrixTraitL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GMatrixData& , TInt&);
       
   696             pGetMatrixTraitL GetMatrixTraitL = &MM2GSVGProxy::GetMatrixTraitL;
       
   697             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   698             // TM2GSvgElementHandle lElementHandle = STATIC_CAST( TM2GSvgElementHandle, aElementHandle );
       
   699             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
   700             TMethodWrapper4<MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GMatrixData& , TInt&  > GetMatrixTrait(
       
   701                 *aProxy,
       
   702                 GetMatrixTraitL,
       
   703                 aElementHandle,
       
   704                 lAttrType,
       
   705                 matrix,
       
   706                 result);
       
   707             err = client->Execute(GetMatrixTrait);
       
   708         }
       
   709     }
       
   710     else
       
   711     {
       
   712         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   713         if (eventSource && aSvgProxyHandle)
       
   714         {
       
   715             err = eventSource->ExecuteTrap(
       
   716                       &DoGetMatrixTraitL,
       
   717                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   718                       aElementHandle,
       
   719                       aAttributeTypeId,
       
   720                       &matrix,
       
   721                       &result);
       
   722         }
       
   723     }
       
   724     if (M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk)
       
   725     {
       
   726         // Init matrix object
       
   727         jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents, 0);
       
   728         TInt count =
       
   729             M2GGeneral::Min(aJni->GetArrayLength(aMatrixComponents), matrix.Count());
       
   730         for (TInt index = 0; index < count; index++)
       
   731         {
       
   732             components[ index ] = matrix[ index ];
       
   733         }
       
   734         // Release data source
       
   735         aJni->ReleaseFloatArrayElements(aMatrixComponents, components, 0);
       
   736     }
       
   737 
       
   738     M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
       
   739     return result;
       
   740 }
       
   741 
       
   742 // -----------------------------------------------------------------------------
       
   743 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getNextElementSibling
       
   744 // -----------------------------------------------------------------------------
       
   745 /**
       
   746  * Calls MM2GSVGProxy::GetNextElementSiblingL method.
       
   747  * @since Series S60 3.0
       
   748  * @param aProxy Proxy instance.
       
   749  * @param aElementHandle Element pointer.
       
   750  * @param aSiblingHandle Sibling handle
       
   751  */
       
   752 LOCAL_C void DoGetNextElementSiblingL(
       
   753     MM2GSVGProxy* aProxy,
       
   754     TInt aElementHandle,
       
   755     TInt* aSiblingHandle)
       
   756 {
       
   757     aProxy->GetNextElementSiblingL(aElementHandle, *aSiblingHandle);
       
   758 }
       
   759 
       
   760 /**
       
   761  * JNI method
       
   762  */
       
   763 JNIEXPORT jint JNICALL
       
   764 Java_com_nokia_microedition_m2g_M2GSVGElement__1getNextElementSibling(
       
   765     JNIEnv* aJni,
       
   766     jclass,
       
   767     jint aEventSourceHandle,
       
   768     jint aSvgProxyHandle,
       
   769     jint aElementHandle,
       
   770     jboolean aUiToolKit)
       
   771 {
       
   772     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling - begin");
       
   773     TInt siblingHandle = M2G_INVALID_HANDLE;
       
   774     TInt err = KM2GNotOk;
       
   775     if (aUiToolKit)  // If eSWT is the current toolkit
       
   776     {
       
   777         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   778         if (client && aSvgProxyHandle)
       
   779         {
       
   780             typedef void (MM2GSVGProxy::*pGetNextElementSiblingL)(const TInt& ,TInt&);
       
   781             pGetNextElementSiblingL GetNextElementSiblingL = &MM2GSVGProxy::GetNextElementSiblingL;
       
   782             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   783             TMethodWrapper2<MM2GSVGProxy, const TInt& ,TInt& > GetNextElementSibling(
       
   784                 *aProxy,
       
   785                 GetNextElementSiblingL,
       
   786                 aElementHandle,
       
   787                 siblingHandle);
       
   788             err = client->Execute(GetNextElementSibling);
       
   789         }
       
   790     }
       
   791     else
       
   792     {
       
   793         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   794         if (eventSource && aSvgProxyHandle)
       
   795         {
       
   796             err = eventSource->ExecuteTrap(
       
   797                       &DoGetNextElementSiblingL,
       
   798                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   799                       aElementHandle, &siblingHandle);
       
   800 
       
   801         }
       
   802     }
       
   803     M2GGeneral::CheckErrorCode(aJni, err);
       
   804     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling: %d - end", siblingHandle);
       
   805     return siblingHandle;
       
   806 }
       
   807 
       
   808 // -----------------------------------------------------------------------------
       
   809 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getParent
       
   810 // -----------------------------------------------------------------------------
       
   811 /**
       
   812  * Calls MM2GSVGProxy::GetParentL method.
       
   813  * @since Series S60 3.0
       
   814  * @param aProxy Proxy instance.
       
   815  * @param aElementHandle Element pointer.
       
   816  * @param aParentHandle Parent handle to be returned.
       
   817  */
       
   818 LOCAL_C void DoGetParentL(
       
   819     MM2GSVGProxy* aProxy,
       
   820     TInt aElementHandle,
       
   821     TInt* aParentHandle)
       
   822 {
       
   823     aProxy->GetParentL(aElementHandle, *aParentHandle);
       
   824 }
       
   825 
       
   826 /**
       
   827  * JNI method
       
   828  */
       
   829 JNIEXPORT jint JNICALL
       
   830 Java_com_nokia_microedition_m2g_M2GSVGElement__1getParent(
       
   831     JNIEnv* aJni,
       
   832     jclass,
       
   833     jint aEventSourceHandle,
       
   834     jint aSvgProxyHandle,
       
   835     jint aElementHandle,
       
   836     jboolean aUiToolKit)
       
   837 {
       
   838     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent - begin");
       
   839     TInt parentHandle = M2G_INVALID_HANDLE;
       
   840     TInt err = KM2GNotOk;
       
   841     if (aUiToolKit)  // If eSWT is the current toolkit
       
   842     {
       
   843         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   844         if (client && aSvgProxyHandle)
       
   845         {
       
   846             typedef void (MM2GSVGProxy::*pGetParentL)(const TInt& ,TInt&);
       
   847             pGetParentL GetParentL = &MM2GSVGProxy::GetParentL;
       
   848             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   849             TMethodWrapper2<MM2GSVGProxy, const TInt& ,TInt& > GetParent(
       
   850                 *aProxy,
       
   851                 GetParentL,
       
   852                 aElementHandle,
       
   853                 parentHandle);
       
   854             err = client->Execute(GetParent);
       
   855         }
       
   856     }
       
   857     else
       
   858     {
       
   859         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   860         if (eventSource && aSvgProxyHandle)
       
   861         {
       
   862             err = eventSource->ExecuteTrap(
       
   863                       &DoGetParentL,
       
   864                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   865                       aElementHandle, &parentHandle);
       
   866 
       
   867         }
       
   868     }
       
   869     M2GGeneral::CheckErrorCode(aJni, err);
       
   870     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent: %d - end", parentHandle);
       
   871     return parentHandle;
       
   872 }
       
   873 
       
   874 // -----------------------------------------------------------------------------
       
   875 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getPathTrait
       
   876 // -----------------------------------------------------------------------------
       
   877 /**
       
   878  * Calls MM2GSVGProxy::GetPathTraitL method.
       
   879  * @since Series S60 3.0
       
   880  * @param aProxy Proxy instance.
       
   881  * @param aElementHandle Element pointer.
       
   882  * @param aAttributeTypeId Attribute type.
       
   883  */
       
   884 
       
   885 LOCAL_C void DoGetPathTraitL(
       
   886     MM2GSVGProxy* aProxy,
       
   887     TInt aElementHandle,
       
   888     TInt16 aAttributeTypeId,
       
   889     TInt* aPathTrait)
       
   890 {
       
   891     aProxy->GetPathTraitL(
       
   892         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   893         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   894         *aPathTrait);
       
   895 }
       
   896 
       
   897 /**
       
   898  * JNI method
       
   899  */
       
   900 JNIEXPORT jint JNICALL
       
   901 Java_com_nokia_microedition_m2g_M2GSVGElement__1getPathTrait(
       
   902     JNIEnv* aJni,
       
   903     jclass,
       
   904     jint aEventSourceHandle,
       
   905     jint aSvgProxyHandle,
       
   906     jint aElementHandle,
       
   907     jshort aAttributeTypeId,
       
   908     jboolean aUiToolKit)
       
   909 {
       
   910     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait - begin");
       
   911     TInt aPathTrait = 0;
       
   912     TInt err = KM2GNotOk;
       
   913     if (aUiToolKit)  // If eSWT is the current toolkit
       
   914     {
       
   915         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
   916         if (client && aSvgProxyHandle)
       
   917         {
       
   918             typedef void (MM2GSVGProxy::*pGetPathTraitL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TInt&);
       
   919             pGetPathTraitL GetPathTraitL = &MM2GSVGProxy::GetPathTraitL;
       
   920             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   921             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
   922             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
   923             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TInt& > GetPathTrait(
       
   924                 *aProxy,
       
   925                 GetPathTraitL,
       
   926                 lElementHandle,
       
   927                 lAttrType,
       
   928                 aPathTrait);
       
   929             err = client->Execute(GetPathTrait);
       
   930         }
       
   931     }
       
   932     else
       
   933     {
       
   934         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
   935         if (eventSource && aSvgProxyHandle)
       
   936         {
       
   937             err = eventSource->ExecuteTrap(
       
   938                       &DoGetPathTraitL,
       
   939                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
   940                       aElementHandle,
       
   941                       aAttributeTypeId, &aPathTrait);
       
   942 
       
   943         }
       
   944     }
       
   945     M2GGeneral::CheckErrorCode(aJni, err);
       
   946     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait: %d - end", aPathTrait);
       
   947     return aPathTrait;
       
   948 }
       
   949 
       
   950 // -----------------------------------------------------------------------------
       
   951 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getRectTrait
       
   952 // -----------------------------------------------------------------------------
       
   953 /**
       
   954  * Calls MM2GSVGProxy::GetRectTraitL method.
       
   955  * @since Series S60 3.0
       
   956  * @param aProxy Proxy instance.
       
   957  * @param aElementHandle Element handle
       
   958  * @param aAttributeTypeId Attribute type id
       
   959  * @param aRectData Returns rect components
       
   960  * @param aResult Result "0" if ok and "-1" if nok
       
   961  */
       
   962 LOCAL_C void DoGetRectTraitL(
       
   963     MM2GSVGProxy* aProxy,
       
   964     TInt aElementHandle,
       
   965     TInt16 aAttributeTypeId,
       
   966     TM2GRectData* aRectData,
       
   967     TInt* aResult)
       
   968 {
       
   969     aProxy->GetRectTraitL(
       
   970         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   971         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   972         *aRectData, *aResult);
       
   973 }
       
   974 /**
       
   975  * JNI method
       
   976  */
       
   977 JNIEXPORT jint JNICALL
       
   978 Java_com_nokia_microedition_m2g_M2GSVGElement__1getRectTrait(
       
   979     JNIEnv* aJni,
       
   980     jclass,
       
   981     jint aEventSourceHandle,
       
   982     jint aSvgProxyHandle,
       
   983     jint aElementHandle,
       
   984     jshort aAttributeTypeId,
       
   985     jfloatArray aRectComponents,
       
   986     jboolean aUiToolKit)
       
   987 {
       
   988     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - begin");
       
   989     TM2GRectData rect;
       
   990     TInt result = 0;
       
   991     TInt err = KM2GNotOk;
       
   992     if (aUiToolKit)  // If eSWT is the current toolkit
       
   993     {
       
   994         MSwtClient* client = reinterpret_cast< MSwtClient*  >(aEventSourceHandle);
       
   995         if (client && aSvgProxyHandle)
       
   996         {
       
   997             typedef void (MM2GSVGProxy::*pGetRectTraitL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GRectData& , TInt&);
       
   998             pGetRectTraitL GetRectTraitL = &MM2GSVGProxy::GetRectTraitL;
       
   999             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1000             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1001             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1002             TMethodWrapper4<MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TM2GRectData& , TInt& > GetRectTrait(
       
  1003                 *aProxy,
       
  1004                 GetRectTraitL,
       
  1005                 lElementHandle,
       
  1006                 lAttrType,
       
  1007                 rect,
       
  1008                 result);
       
  1009             err = client->Execute(GetRectTrait);
       
  1010         }
       
  1011     }
       
  1012     else
       
  1013     {
       
  1014         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1015         if (eventSource && aSvgProxyHandle)
       
  1016         {
       
  1017             err = eventSource->ExecuteTrap(
       
  1018                       &DoGetRectTraitL,
       
  1019                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1020                       aElementHandle,
       
  1021                       aAttributeTypeId,
       
  1022                       &rect, &result);
       
  1023         }
       
  1024     }
       
  1025     M2GGeneral::CheckErrorCode(aJni, err);
       
  1026     aJni->SetFloatArrayRegion(
       
  1027         REINTERPRET_CAST(jfloatArray, aRectComponents),
       
  1028         0,
       
  1029         rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
       
  1030 
       
  1031     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait: %d - end", result);
       
  1032     return result;
       
  1033 }
       
  1034 
       
  1035 // -----------------------------------------------------------------------------
       
  1036 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getRootElement
       
  1037 // -----------------------------------------------------------------------------
       
  1038 /**
       
  1039  * Calls MM2GSVGProxy::GetRootElementL method.
       
  1040  * @since Series S60 3.0
       
  1041  * @param aProxy Proxy instance.
       
  1042  * @param aDocumentHandle Document pointer.
       
  1043  * @param aRootElementHandle Root element handle
       
  1044  */
       
  1045 LOCAL_C void DoGetRootElementL(MM2GSVGProxy* aProxy, TInt aDocumentHandle,
       
  1046                                TInt* aRootElementHandle)
       
  1047 {
       
  1048     aProxy->GetRootElementL(
       
  1049         STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
       
  1050         *aRootElementHandle);
       
  1051 }
       
  1052 
       
  1053 /**
       
  1054  * JNI method
       
  1055  */
       
  1056 JNIEXPORT jint JNICALL
       
  1057 Java_com_nokia_microedition_m2g_M2GSVGElement__1getRootElement(
       
  1058     JNIEnv* aJni,
       
  1059     jclass,
       
  1060     jint aEventSourceHandle,
       
  1061     jint aSvgProxyHandle,
       
  1062     jint aDocumentHandle,
       
  1063     jboolean aUiToolKit)
       
  1064 {
       
  1065     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement - begin");
       
  1066     TInt rootElementHandle = M2G_INVALID_HANDLE;
       
  1067     TInt err = KM2GNotOk;
       
  1068     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1069     {
       
  1070         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1071         if (client && aSvgProxyHandle)
       
  1072         {
       
  1073             typedef void (MM2GSVGProxy::*pGetRootElementL)(const TM2GSvgDocumentHandle& ,TInt&);
       
  1074             pGetRootElementL GetRootElementL = &MM2GSVGProxy::GetRootElementL;
       
  1075             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1076             TM2GSvgDocumentHandle lHandle = STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle);
       
  1077             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgDocumentHandle& ,TInt&  > GetRootElement(
       
  1078                 *aProxy,
       
  1079                 GetRootElementL,
       
  1080                 lHandle,
       
  1081                 rootElementHandle
       
  1082             );
       
  1083             err = client->Execute(GetRootElement);
       
  1084         }
       
  1085     }
       
  1086     else
       
  1087     {
       
  1088         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1089 
       
  1090         if (eventSource && aSvgProxyHandle)
       
  1091         {
       
  1092             err = eventSource->ExecuteTrap(
       
  1093                       &DoGetRootElementL,
       
  1094                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1095                       aDocumentHandle,
       
  1096                       &rootElementHandle);
       
  1097         }
       
  1098     }
       
  1099     M2GGeneral::CheckErrorCode(aJni, err);
       
  1100 
       
  1101     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement: %d - end", rootElementHandle);
       
  1102     return rootElementHandle;
       
  1103 }
       
  1104 
       
  1105 // -----------------------------------------------------------------------------
       
  1106 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getScreenBBox
       
  1107 // -----------------------------------------------------------------------------
       
  1108 /**
       
  1109  * Calls MM2GSVGProxy::GetScreenBBoxL method.
       
  1110  * @since Series S60 3.0
       
  1111  * @param aProxy Proxy instance.
       
  1112  * @param aElementHandle Element handle
       
  1113  * @param aRectData Returns rect components
       
  1114  */
       
  1115 LOCAL_C void DoGetScreenBBoxL(
       
  1116     MM2GSVGProxy* aProxy,
       
  1117     TInt aElementHandle,
       
  1118     TM2GScreenBBoxData* aScreenBBoxData)
       
  1119 {
       
  1120     aProxy->GetScreenBBoxL(
       
  1121         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1122         *aScreenBBoxData);
       
  1123 }
       
  1124 /**
       
  1125  * Class: com_nokia_microedition_m2g_M2GSVGElement
       
  1126  * Method: getScreenBBox
       
  1127  * Signature:
       
  1128  */
       
  1129 JNIEXPORT void JNICALL
       
  1130 Java_com_nokia_microedition_m2g_M2GSVGElement__1getScreenBBox(
       
  1131     JNIEnv* aJni,
       
  1132     jclass,
       
  1133     jint aEventSourceHandle,
       
  1134     jint aSvgProxyHandle,
       
  1135     jint aElementHandle,
       
  1136     jfloatArray aScreenBBoxComponents,
       
  1137     jboolean aUiToolKit)
       
  1138 {
       
  1139     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox - begin");
       
  1140     TM2GScreenBBoxData screenBBox;
       
  1141     TInt err = KM2GNotOk;
       
  1142     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1143     {
       
  1144         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1145         if (client && aSvgProxyHandle)
       
  1146         {
       
  1147             typedef void (MM2GSVGProxy::*pGetScreenBBoxL)(const TM2GSvgElementHandle& ,TM2GScreenBBoxData&);
       
  1148             pGetScreenBBoxL GetScreenBBoxL = &MM2GSVGProxy::GetScreenBBoxL;
       
  1149             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1150             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1151             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgElementHandle& ,TM2GScreenBBoxData&  > GetScreenBBox(
       
  1152                 *aProxy,
       
  1153                 GetScreenBBoxL,
       
  1154                 lElementHandle,
       
  1155                 screenBBox
       
  1156             );
       
  1157             err = client->Execute(GetScreenBBox);
       
  1158         }
       
  1159     }
       
  1160     else
       
  1161     {
       
  1162         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1163         if (eventSource && aSvgProxyHandle)
       
  1164         {
       
  1165             err = eventSource->ExecuteTrap(
       
  1166                       &DoGetScreenBBoxL,
       
  1167                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1168                       aElementHandle,
       
  1169                       &screenBBox);
       
  1170         }
       
  1171     }
       
  1172     M2GGeneral::CheckErrorCode(aJni, err);
       
  1173 
       
  1174     aJni->SetFloatArrayRegion(
       
  1175         REINTERPRET_CAST(jfloatArray, aScreenBBoxComponents),
       
  1176         0,
       
  1177         screenBBox.Count(), REINTERPRET_CAST(jfloat*, screenBBox.Begin()));
       
  1178 
       
  1179     M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox: %f, %f, %f, %f - end", screenBBox[ 0 ], screenBBox[ 1 ], screenBBox[ 2 ], screenBBox[ 3 ]);
       
  1180 }
       
  1181 
       
  1182 // -----------------------------------------------------------------------------
       
  1183 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getStringTrait
       
  1184 // -----------------------------------------------------------------------------
       
  1185 /**
       
  1186  * Calls MM2GSVGProxy::GetStringTraitL method.
       
  1187  * @since Series S60 3.0
       
  1188  * @param aProxy Proxy instance.
       
  1189  * @param aElementHandle Element pointer.
       
  1190  * @param aAttributeTypeId Attribute type.
       
  1191  * @param aAttribute Returns a string attribute
       
  1192  */
       
  1193 LOCAL_C void DoGetStringTraitL(
       
  1194     MM2GSVGProxy* aProxy,
       
  1195     TInt aElementHandle,
       
  1196     TInt16 aAttributeTypeId,
       
  1197     TPtrC16* aAttribute)
       
  1198 {
       
  1199     aProxy->GetStringTraitL(
       
  1200         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1201         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1202         *aAttribute);
       
  1203 }
       
  1204 
       
  1205 /**
       
  1206  * JNI method
       
  1207  */
       
  1208 JNIEXPORT jstring JNICALL
       
  1209 Java_com_nokia_microedition_m2g_M2GSVGElement__1getStringTrait(
       
  1210     JNIEnv* aJni,
       
  1211     jclass,
       
  1212     jint aEventSourceHandle,
       
  1213     jint aSvgProxyHandle,
       
  1214     jint aElementHandle,
       
  1215     jshort aAttributeTypeId,
       
  1216     jboolean aUiToolKit)
       
  1217 {
       
  1218     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait - begin");
       
  1219 
       
  1220     TPtrC16 attribute;
       
  1221     TInt err = KM2GNotOk;
       
  1222     TInt Res;
       
  1223     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1224     {
       
  1225         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1226         if (client && aSvgProxyHandle)
       
  1227         {
       
  1228             typedef TInt(MM2GSVGProxy::*pGetStringTraitL)(const TM2GSvgElementHandle& ,const TM2GSvgAttrType& ,TPtrC16&);
       
  1229             pGetStringTraitL GetStringTraitL = &MM2GSVGProxy::GetStringTraitL;
       
  1230             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1231             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1232             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1233             TMethodWrapperR3< TInt , TInt , MM2GSVGProxy, const TM2GSvgElementHandle& ,const TM2GSvgAttrType& , TPtrC16&  >GetStringTrait(
       
  1234                 Res,
       
  1235                 *aProxy,
       
  1236                 GetStringTraitL,
       
  1237                 lElementHandle,
       
  1238                 lAttrType,
       
  1239                 attribute
       
  1240             );
       
  1241             err = client->Execute(GetStringTrait);
       
  1242         }
       
  1243     }
       
  1244     else
       
  1245     {
       
  1246         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1247         if (eventSource && aSvgProxyHandle)
       
  1248         {
       
  1249             err = eventSource->ExecuteTrap(
       
  1250                       &DoGetStringTraitL,
       
  1251                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1252                       aElementHandle,
       
  1253                       aAttributeTypeId,
       
  1254                       &attribute);
       
  1255         }
       
  1256     }
       
  1257     if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) &&
       
  1258             (attribute.Length() > 0))
       
  1259     {
       
  1260         return CreateJavaString(*aJni, attribute);
       
  1261     }
       
  1262 
       
  1263     return NULL;
       
  1264     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait: %d - end", err);
       
  1265 }
       
  1266 
       
  1267 // -----------------------------------------------------------------------------
       
  1268 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getUsedFromElement
       
  1269 // -----------------------------------------------------------------------------
       
  1270 /**
       
  1271  * Calls MM2GSVGProxy::GetUsedFromElementL method.
       
  1272  * @since Series S60 3.0
       
  1273  * @param aProxy Proxy instance.
       
  1274  * @param aElementHandle Element pointer.
       
  1275  * @param aHandle Return element handle
       
  1276  */
       
  1277 LOCAL_C void DoGetUsedFromElementL(
       
  1278     MM2GSVGProxy* aProxy,
       
  1279     TInt aElementHandle,
       
  1280     TInt* aHandle)
       
  1281 {
       
  1282     aProxy->GetUsedFromElementL(
       
  1283         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1284         *aHandle);
       
  1285 }
       
  1286 
       
  1287 /**
       
  1288  * JNI method
       
  1289  */
       
  1290 JNIEXPORT jint JNICALL
       
  1291 Java_com_nokia_microedition_m2g_M2GSVGElement__1getUsedFromElement(
       
  1292     JNIEnv* aJni,
       
  1293     jclass,
       
  1294     jint aEventSourceHandle,
       
  1295     jint aSvgProxyHandle,
       
  1296     jint aElementHandle,
       
  1297     jboolean aUiToolKit)
       
  1298 {
       
  1299     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement - begin");
       
  1300     TInt handle = M2G_INVALID_HANDLE;
       
  1301     TInt err = KM2GNotOk;
       
  1302     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1303     {
       
  1304         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1305         if (client && aSvgProxyHandle)
       
  1306         {
       
  1307             typedef void (MM2GSVGProxy::*pGetUsedFromElementL)(const TM2GSvgElementHandle& , TInt &);
       
  1308             pGetUsedFromElementL GetUsedFromElementL = &MM2GSVGProxy::GetUsedFromElementL;
       
  1309             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1310             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1311             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgElementHandle& ,TInt &  >GetUsedFromElement(
       
  1312                 *aProxy,
       
  1313                 GetUsedFromElementL,
       
  1314                 lElementHandle,
       
  1315                 handle
       
  1316             );
       
  1317             err = client->Execute(GetUsedFromElement);
       
  1318         }
       
  1319     }
       
  1320     else
       
  1321     {
       
  1322         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1323         if (eventSource && aSvgProxyHandle)
       
  1324         {
       
  1325             err = eventSource->ExecuteTrap(
       
  1326                       &DoGetUsedFromElementL,
       
  1327                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1328                       aElementHandle, &handle);
       
  1329 
       
  1330         }
       
  1331     }
       
  1332     M2GGeneral::CheckErrorCode(aJni, err);
       
  1333     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement: %d - end", handle);
       
  1334     return handle;
       
  1335 }
       
  1336 
       
  1337 
       
  1338 // -----------------------------------------------------------------------------
       
  1339 // Java_com_nokia_microedition_m2g_M2GSVGElement::_insertBefore
       
  1340 // -----------------------------------------------------------------------------
       
  1341 /**
       
  1342  * Calls MM2GSVGProxy::InsertBeforeL method.
       
  1343  * @since Series S60 3.0
       
  1344  * @param aProxy Proxy instance.
       
  1345  * @param aElementHandle Element handle
       
  1346  * @param aRectData Returns rect components
       
  1347  */
       
  1348 LOCAL_C void DoInsertBeforeL(
       
  1349     MM2GSVGProxy* aProxy,
       
  1350     TInt aElementHandle,
       
  1351     TInt aNewChildElementHandle,
       
  1352     TInt aReferenceElementHandle)
       
  1353 {
       
  1354     aProxy->InsertBeforeL(
       
  1355         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1356         STATIC_CAST(TM2GSvgElementHandle, aNewChildElementHandle),
       
  1357         STATIC_CAST(TM2GSvgElementHandle, aReferenceElementHandle));
       
  1358 }
       
  1359 /**
       
  1360  * Class: com_nokia_microedition_m2g_M2GSVGElement
       
  1361  * Method: insertBefore
       
  1362  * Signature:
       
  1363  */
       
  1364 JNIEXPORT void JNICALL
       
  1365 Java_com_nokia_microedition_m2g_M2GSVGElement__1insertBefore(
       
  1366     JNIEnv* aJni,
       
  1367     jclass,
       
  1368     jint aEventSourceHandle,
       
  1369     jint aSvgProxyHandle,
       
  1370     jint aElementHandle,
       
  1371     jint aNewChildElementHandle,
       
  1372     jint aReferenceElementHandle ,
       
  1373     jboolean aUiToolKit)
       
  1374 {
       
  1375     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - begin");
       
  1376     TInt err = KM2GNotOk;
       
  1377     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1378     {
       
  1379         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1380         if (client && aSvgProxyHandle)
       
  1381         {
       
  1382             typedef void (MM2GSVGProxy::*pInsertBeforeL)(const TM2GSvgElementHandle& , const TM2GSvgElementHandle&,const TM2GSvgElementHandle&);
       
  1383             pInsertBeforeL InsertBeforeL = &MM2GSVGProxy::InsertBeforeL;
       
  1384             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1385             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1386             TM2GSvgElementHandle lNewChildElementHandle = STATIC_CAST(TM2GSvgElementHandle, aNewChildElementHandle);
       
  1387             TM2GSvgElementHandle lReferenceElementHandle = STATIC_CAST(TM2GSvgElementHandle, aReferenceElementHandle);
       
  1388             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle& , const TM2GSvgElementHandle&,const TM2GSvgElementHandle&   >InsertBefore(
       
  1389                 *aProxy,
       
  1390                 InsertBeforeL,
       
  1391                 lElementHandle,
       
  1392                 lNewChildElementHandle,
       
  1393                 lReferenceElementHandle
       
  1394             );
       
  1395             err = client->Execute(InsertBefore);
       
  1396         }
       
  1397     }
       
  1398     else
       
  1399     {
       
  1400         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1401         if (eventSource && aSvgProxyHandle)
       
  1402         {
       
  1403             err = eventSource->ExecuteTrap(
       
  1404                       &DoInsertBeforeL,
       
  1405                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1406                       aElementHandle,
       
  1407                       aNewChildElementHandle,
       
  1408                       aReferenceElementHandle);
       
  1409         }
       
  1410     }
       
  1411     M2GGeneral::CheckErrorCode(aJni, err);
       
  1412     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - end");
       
  1413 }
       
  1414 
       
  1415 // -----------------------------------------------------------------------------
       
  1416 // Java_com_nokia_microedition_m2g_M2GSVGElement::_isUsed
       
  1417 // -----------------------------------------------------------------------------
       
  1418 /**
       
  1419  * Calls MM2GSVGProxy::IsUsedL method.
       
  1420  * @since Series S60 3.0
       
  1421  * @param aProxy Proxy instance.
       
  1422  * @param aElementHandle Element pointer.
       
  1423  * @param aResult Return "1" if used otherwise returns "0"
       
  1424  */
       
  1425 LOCAL_C void DoIsUsedL(
       
  1426     MM2GSVGProxy* aProxy,
       
  1427     TInt aElementHandle,
       
  1428     TInt* aResult)
       
  1429 {
       
  1430     aProxy->IsUsedL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), *aResult);
       
  1431 }
       
  1432 
       
  1433 /**
       
  1434  * JNI method
       
  1435  */
       
  1436 JNIEXPORT jint JNICALL
       
  1437 Java_com_nokia_microedition_m2g_M2GSVGElement__1isUsed(
       
  1438     JNIEnv* aJni,
       
  1439     jclass,
       
  1440     jint aEventSourceHandle,
       
  1441     jint aSvgProxyHandle,
       
  1442     jint aElementHandle ,
       
  1443     jboolean aUiToolKit)
       
  1444 {
       
  1445     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed - begin");
       
  1446     TInt result = KM2GNotOk;
       
  1447     TInt err = KM2GNotOk;
       
  1448     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1449     {
       
  1450         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1451         if (client && aSvgProxyHandle)
       
  1452         {
       
  1453             typedef void (MM2GSVGProxy::*pIsUsedL)(const TM2GSvgElementHandle& , TInt&);
       
  1454             pIsUsedL IsUsedL = &MM2GSVGProxy::IsUsedL;
       
  1455             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1456             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1457             TMethodWrapper2<MM2GSVGProxy, const TM2GSvgElementHandle& , TInt&   >IsUsed(
       
  1458                 *aProxy,
       
  1459                 IsUsedL,
       
  1460                 lElementHandle,
       
  1461                 result
       
  1462             );
       
  1463             err = client->Execute(IsUsed);
       
  1464         }
       
  1465     }
       
  1466     else
       
  1467     {
       
  1468         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1469 
       
  1470         if (eventSource && aSvgProxyHandle)
       
  1471         {
       
  1472             err = eventSource->ExecuteTrap(
       
  1473                       &DoIsUsedL,
       
  1474                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1475                       aElementHandle, &result);
       
  1476         }
       
  1477     }
       
  1478     M2GGeneral::CheckErrorCode(aJni, err);
       
  1479     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed: %d - end", result);
       
  1480     return result;
       
  1481 }
       
  1482 
       
  1483 // -----------------------------------------------------------------------------
       
  1484 // Java_com_nokia_microedition_m2g_M2GSVGElement::_removeChild
       
  1485 // -----------------------------------------------------------------------------
       
  1486 /**
       
  1487  * Calls MM2GSVGProxy::RemoveChild method.
       
  1488  * @since Series S60 3.0
       
  1489  * @param aProxy Proxy instance.
       
  1490  * @param aElementHandle Element pointer.
       
  1491  * @param aChildElementHandle child element pointer
       
  1492  * @param aHandle Handle to removed element.
       
  1493  */
       
  1494 LOCAL_C void DoRemoveChildL(
       
  1495     MM2GSVGProxy* aProxy,
       
  1496     TInt aElementHandle,
       
  1497     TInt aChildElementHandle,
       
  1498     TInt* aHandle)
       
  1499 {
       
  1500     aProxy->RemoveChildL(
       
  1501         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1502         STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle), *aHandle);
       
  1503 }
       
  1504 
       
  1505 /**
       
  1506  * JNI method
       
  1507  */
       
  1508 JNIEXPORT jint JNICALL
       
  1509 Java_com_nokia_microedition_m2g_M2GSVGElement__1removeChild(
       
  1510     JNIEnv* aJni,
       
  1511     jclass,
       
  1512     jint aEventSourceHandle,
       
  1513     jint aSvgProxyHandle,
       
  1514     jint aElementHandle,
       
  1515     jint aChildElementHandle,
       
  1516     jboolean aUiToolKit)
       
  1517 {
       
  1518     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild - begin");
       
  1519     TInt handle = M2G_INVALID_HANDLE;
       
  1520     TInt err = KM2GNotOk;
       
  1521     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1522     {
       
  1523         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1524         if (client && aSvgProxyHandle)
       
  1525         {
       
  1526             typedef void (MM2GSVGProxy::*pRemoveChildL)(const TM2GSvgElementHandle& , const TM2GSvgElementHandle&, TInt&);
       
  1527             pRemoveChildL RemoveChildL = &MM2GSVGProxy::RemoveChildL;
       
  1528             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1529             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1530             TM2GSvgElementHandle lChildElementHandle = STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle);
       
  1531             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle& , const TM2GSvgElementHandle&, TInt&   >RemoveChild(
       
  1532                 *aProxy,
       
  1533                 RemoveChildL,
       
  1534                 lElementHandle,
       
  1535                 lChildElementHandle,
       
  1536                 handle
       
  1537             );
       
  1538             err = client->Execute(RemoveChild);
       
  1539         }
       
  1540     }
       
  1541     else
       
  1542     {
       
  1543         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1544 
       
  1545         if (eventSource && aSvgProxyHandle)
       
  1546         {
       
  1547             err = eventSource->ExecuteTrap(
       
  1548                       &DoRemoveChildL,
       
  1549                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1550                       aElementHandle,
       
  1551                       aChildElementHandle, &handle);
       
  1552         }
       
  1553     }
       
  1554     M2GGeneral::CheckErrorCode(aJni, err);
       
  1555 
       
  1556     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild: %d - end", handle);
       
  1557     return handle;
       
  1558 }
       
  1559 
       
  1560 // -----------------------------------------------------------------------------
       
  1561 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setColorTrait
       
  1562 // -----------------------------------------------------------------------------
       
  1563 /**
       
  1564  * Calls MM2GSVGProxy::SetColorTraitL method.
       
  1565  * @since Series S60 3.0
       
  1566  * @param aProxy Proxy instance.
       
  1567  * @param aElementHandle Element pointer.
       
  1568  * @param aAttributeTypeId -
       
  1569  * @param aColorData -
       
  1570  */
       
  1571 LOCAL_C void DoSetColorTraitL(
       
  1572     MM2GSVGProxy* aProxy,
       
  1573     TInt aElementHandle,
       
  1574     TInt16 aAttributeTypeId,
       
  1575     TM2GColorData* aColorData)
       
  1576 {
       
  1577     aProxy->SetColorTraitL(
       
  1578         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1579         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1580         *aColorData);
       
  1581 }
       
  1582 
       
  1583 /**
       
  1584  * JNI method
       
  1585  */
       
  1586 JNIEXPORT void JNICALL
       
  1587 Java_com_nokia_microedition_m2g_M2GSVGElement__1setColorTrait(
       
  1588     JNIEnv* aJni,
       
  1589     jclass,
       
  1590     jint aEventSourceHandle,
       
  1591     jint aSvgProxyHandle,
       
  1592     jint aElementHandle,
       
  1593     jshort aAttributeTypeId,
       
  1594     jint aRed, jint aGreen, jint aBlue,
       
  1595     jboolean aUiToolKit)
       
  1596 {
       
  1597     M2G_DEBUG_3("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: R=%d, G=%d, B=%d - begin", aRed, aGreen, aBlue);
       
  1598     TM2GColorData color;
       
  1599     color[ 0 ] = aRed;
       
  1600     color[ 1 ] = aGreen;
       
  1601     color[ 2 ] = aBlue;
       
  1602     TInt err = KM2GNotOk;
       
  1603 
       
  1604     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1605     {
       
  1606         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1607         if (client && aSvgProxyHandle)
       
  1608         {
       
  1609             typedef void (MM2GSVGProxy::*pSetColorTraitL)(const TM2GSvgElementHandle& , const TM2GSvgAttrType& , const TM2GColorData&);
       
  1610             pSetColorTraitL SetColorTraitL = &MM2GSVGProxy::SetColorTraitL;
       
  1611             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1612             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1613             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1614             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle& , const TM2GSvgAttrType& , const TM2GColorData&  >SetColorTrait(
       
  1615                 *aProxy,
       
  1616                 SetColorTraitL,
       
  1617                 lElementHandle,
       
  1618                 lAttrType,
       
  1619                 color
       
  1620             );
       
  1621             err = client->Execute(SetColorTrait);
       
  1622         }
       
  1623     }
       
  1624     else
       
  1625     {
       
  1626         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1627         if (eventSource && aSvgProxyHandle)
       
  1628         {
       
  1629             err = eventSource->ExecuteTrap(
       
  1630                       &DoSetColorTraitL,
       
  1631                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1632                       aElementHandle,
       
  1633                       aAttributeTypeId,
       
  1634                       &color);
       
  1635         }
       
  1636     }
       
  1637     M2GGeneral::CheckErrorCode(aJni, err);
       
  1638     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: %d - end", err);
       
  1639 }
       
  1640 
       
  1641 
       
  1642 // -----------------------------------------------------------------------------
       
  1643 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setEnumTrait
       
  1644 // -----------------------------------------------------------------------------
       
  1645 /**
       
  1646  * Calls MM2GSVGProxy::SetEnumTraitL method.
       
  1647  * @since Series S60 3.0
       
  1648  * @param aProxy Proxy instance.
       
  1649  * @param aElementHandle Element pointer.
       
  1650  * @param aAttributeTypeId -
       
  1651  * @param aValue -
       
  1652  */
       
  1653 LOCAL_C void DoSetEnumTraitL(
       
  1654     MM2GSVGProxy* aProxy,
       
  1655     TInt aElementHandle,
       
  1656     TInt16 aAttributeTypeId,
       
  1657     TInt16 aValue)
       
  1658 {
       
  1659     aProxy->SetEnumTraitL(
       
  1660         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1661         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1662         aValue);
       
  1663 }
       
  1664 
       
  1665 /**
       
  1666  * JNI method
       
  1667  */
       
  1668 JNIEXPORT void JNICALL
       
  1669 Java_com_nokia_microedition_m2g_M2GSVGElement__1setEnumTrait(
       
  1670     JNIEnv* aJni,
       
  1671     jclass,
       
  1672     jint aEventSourceHandle,
       
  1673     jint aSvgProxyHandle,
       
  1674     jint aElementHandle,
       
  1675     jshort aAttributeTypeId,
       
  1676     jshort aValue,
       
  1677     jboolean aUiToolKit)
       
  1678 {
       
  1679     M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait: type=%d, value=%d - begin", aAttributeTypeId, aValue);
       
  1680     TInt err = KM2GNotOk;
       
  1681     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1682     {
       
  1683         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1684         if (client && aSvgProxyHandle)
       
  1685         {
       
  1686             typedef void (MM2GSVGProxy::*pSetEnumTraitL)(const TM2GSvgElementHandle&,const TM2GSvgAttrType&,TInt16);
       
  1687             pSetEnumTraitL SetEnumTraitL = &MM2GSVGProxy::SetEnumTraitL;
       
  1688             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1689             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1690             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1691             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&,const TM2GSvgAttrType&,TInt16  >SetEnumTrait(
       
  1692                 *aProxy,
       
  1693                 SetEnumTraitL,
       
  1694                 lElementHandle,
       
  1695                 lAttrType,
       
  1696                 aValue
       
  1697             );
       
  1698             err = client->Execute(SetEnumTrait);
       
  1699         }
       
  1700     }
       
  1701     else
       
  1702     {
       
  1703         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1704         if (eventSource && aSvgProxyHandle)
       
  1705         {
       
  1706             err = eventSource->ExecuteTrap(
       
  1707                       &DoSetEnumTraitL,
       
  1708                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1709                       aElementHandle,
       
  1710                       aAttributeTypeId,
       
  1711                       aValue);
       
  1712         }
       
  1713     }
       
  1714     M2GGeneral::CheckErrorCode(aJni, err);
       
  1715     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait - end");
       
  1716 }
       
  1717 
       
  1718 // -----------------------------------------------------------------------------
       
  1719 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setFloatTrait
       
  1720 // -----------------------------------------------------------------------------
       
  1721 /**
       
  1722  * Calls MM2GSVGProxy::SetFloatTraitL method.
       
  1723  * @since Series S60 3.0
       
  1724  * @param aProxy Proxy instance.
       
  1725  * @param aElementHandle Element pointer.
       
  1726  * @param aAttributeTypeId -
       
  1727  * @param aValue -
       
  1728  */
       
  1729 LOCAL_C void DoSetFloatTraitL(
       
  1730     MM2GSVGProxy* aProxy,
       
  1731     TInt aElementHandle,
       
  1732     TInt16 aAttributeTypeId,
       
  1733     TReal32* aValue)
       
  1734 {
       
  1735     aProxy->SetFloatTraitL(
       
  1736         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1737         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1738         *aValue);
       
  1739 }
       
  1740 
       
  1741 /**
       
  1742  * JNI method
       
  1743  */
       
  1744 JNIEXPORT void JNICALL
       
  1745 Java_com_nokia_microedition_m2g_M2GSVGElement__1setFloatTrait(
       
  1746     JNIEnv* aJni,
       
  1747     jclass,
       
  1748     jint aEventSourceHandle,
       
  1749     jint aSvgProxyHandle,
       
  1750     jint aElementHandle,
       
  1751     jshort aAttributeTypeId,
       
  1752     jfloat aValue ,
       
  1753     jboolean aUiToolKit)
       
  1754 {
       
  1755     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: %f - begin", aValue);
       
  1756     TInt err = KM2GNotOk;
       
  1757     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1758     {
       
  1759         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1760         if (client && aSvgProxyHandle)
       
  1761         {
       
  1762             typedef void (MM2GSVGProxy::*pSetFloatTraitL)(const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TReal32&);
       
  1763             pSetFloatTraitL SetFloatTraitL = &MM2GSVGProxy::SetFloatTraitL;
       
  1764             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1765             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1766             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1767             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TReal32&  >SetFloatTrait(
       
  1768                 *aProxy,
       
  1769                 SetFloatTraitL,
       
  1770                 lElementHandle,
       
  1771                 lAttrType,
       
  1772                 aValue
       
  1773             );
       
  1774             err = client->Execute(SetFloatTrait);
       
  1775         }
       
  1776     }
       
  1777     else
       
  1778     {
       
  1779         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1780         if (eventSource && aSvgProxyHandle)
       
  1781         {
       
  1782             err = eventSource->ExecuteTrap(
       
  1783                       &DoSetFloatTraitL,
       
  1784                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1785                       aElementHandle,
       
  1786                       aAttributeTypeId, REINTERPRET_CAST(TReal32*, &aValue));
       
  1787         }
       
  1788     }
       
  1789     M2GGeneral::CheckErrorCode(aJni, err);
       
  1790     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: - end");
       
  1791 }
       
  1792 
       
  1793 // -----------------------------------------------------------------------------
       
  1794 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setMatrixTrait
       
  1795 // -----------------------------------------------------------------------------
       
  1796 /**
       
  1797  * Calls MM2GSVGProxy::SetMatrixTraitL method.
       
  1798  * @since Series S60 3.0
       
  1799  * @param aProxy Proxy instance.
       
  1800  * @param aElementHandle Element handle
       
  1801  * @param aAttributeTypeId Attribute type id
       
  1802  * @param aMatrixData -
       
  1803  */
       
  1804 LOCAL_C void DoSetMatrixTraitL(
       
  1805     MM2GSVGProxy* aProxy,
       
  1806     TInt aElementHandle,
       
  1807     TInt16 aAttributeTypeId,
       
  1808     TM2GMatrixData* aMatrix)
       
  1809 {
       
  1810     aProxy->SetMatrixTraitL(
       
  1811         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1812         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1813         *aMatrix);
       
  1814 }
       
  1815 
       
  1816 /**
       
  1817  * JNI method
       
  1818  */
       
  1819 JNIEXPORT void JNICALL
       
  1820 Java_com_nokia_microedition_m2g_M2GSVGElement__1setMatrixTrait(
       
  1821     JNIEnv* aJni,
       
  1822     jclass,
       
  1823     jint aEventSourceHandle,
       
  1824     jint aSvgProxyHandle,
       
  1825     jint aElementHandle,
       
  1826     jshort aAttributeTypeId,
       
  1827     jfloatArray aMatrixComponents,
       
  1828     jboolean aUiToolKit)
       
  1829 {
       
  1830     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setMatrixTrait - begin");
       
  1831     TInt err = KM2GNotOk;
       
  1832     TM2GMatrixData matrix;
       
  1833     // Init matrix object
       
  1834     jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents,0);
       
  1835     TInt count = aJni->GetArrayLength(aMatrixComponents);
       
  1836     for (TInt index = 0; index < count; index++)
       
  1837     {
       
  1838         matrix[ index ] = components[ index ];
       
  1839     }
       
  1840     // Release data source
       
  1841     aJni->ReleaseFloatArrayElements(aMatrixComponents, components, JNI_ABORT);
       
  1842     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1843     {
       
  1844         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1845         if (client && aSvgProxyHandle)
       
  1846         {
       
  1847             typedef void (MM2GSVGProxy::*pSetMatrixTraitL)(const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TM2GMatrixData&);
       
  1848             pSetMatrixTraitL SetMatrixTraitL = &MM2GSVGProxy::SetMatrixTraitL;
       
  1849             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1850             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1851             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1852             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TM2GMatrixData&  >SetMatrixTrait(
       
  1853                 *aProxy,
       
  1854                 SetMatrixTraitL,
       
  1855                 lElementHandle,
       
  1856                 lAttrType,
       
  1857                 matrix
       
  1858             );
       
  1859             err = client->Execute(SetMatrixTrait);
       
  1860         }
       
  1861     }
       
  1862     else
       
  1863     {
       
  1864         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1865         if (eventSource && aSvgProxyHandle)
       
  1866         {
       
  1867             err = eventSource->ExecuteTrap(
       
  1868                       &DoSetMatrixTraitL,
       
  1869                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1870                       aElementHandle,
       
  1871                       aAttributeTypeId,
       
  1872                       &matrix);
       
  1873 
       
  1874         }
       
  1875     }
       
  1876     M2GGeneral::CheckErrorCode(aJni, err);
       
  1877     M2G_DEBUG_6("JNI ( M2GSVGElement ) _setMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
       
  1878 }
       
  1879 
       
  1880 // -----------------------------------------------------------------------------
       
  1881 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setPathTrait
       
  1882 // -----------------------------------------------------------------------------
       
  1883 /**
       
  1884  * Calls MM2GSVGProxy::SetPathTraitL method.
       
  1885  * @since Series S60 3.0
       
  1886  * @param aProxy Proxy instance.
       
  1887  * @param aElementHandle Element handle
       
  1888  * @param aAttributeTypeId Attribute type id
       
  1889  * @param aMatrixData -
       
  1890  */
       
  1891 LOCAL_C void DoSetPathTraitL(
       
  1892     MM2GSVGProxy* aProxy,
       
  1893     TInt aElementHandle,
       
  1894     TInt16 aAttributeTypeId,
       
  1895     TInt aPathHandle)
       
  1896 {
       
  1897     aProxy->SetPathTraitL(
       
  1898         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1899         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1900         STATIC_CAST(TM2GSvgPathHandle, aPathHandle));
       
  1901 }
       
  1902 /**
       
  1903  * JNI method
       
  1904  */
       
  1905 JNIEXPORT void JNICALL
       
  1906 Java_com_nokia_microedition_m2g_M2GSVGElement__1setPathTrait(
       
  1907     JNIEnv* aJni,
       
  1908     jclass,
       
  1909     jint aEventSourceHandle,
       
  1910     jint aSvgProxyHandle,
       
  1911     jint aElementHandle,
       
  1912     jshort aAttributeTypeId,
       
  1913     jint aPathHandle,
       
  1914     jboolean aUiToolKit)
       
  1915 {
       
  1916     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - begin");
       
  1917     TInt err = KM2GNotOk;
       
  1918     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1919     {
       
  1920         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  1921         if (client && aSvgProxyHandle)
       
  1922         {
       
  1923             typedef void (MM2GSVGProxy::*pSetPathTraitL)(const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TM2GSvgPathHandle&);
       
  1924             pSetPathTraitL SetPathTraitL = &MM2GSVGProxy::SetPathTraitL;
       
  1925             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1926             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  1927             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  1928             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TM2GSvgPathHandle& >SetPathTrait(
       
  1929                 *aProxy,
       
  1930                 SetPathTraitL,
       
  1931                 lElementHandle,
       
  1932                 lAttrType,
       
  1933                 aPathHandle
       
  1934             );
       
  1935             err = client->Execute(SetPathTrait);
       
  1936         }
       
  1937     }
       
  1938     else
       
  1939     {
       
  1940         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  1941         if (eventSource && aSvgProxyHandle)
       
  1942         {
       
  1943             err = eventSource->ExecuteTrap(
       
  1944                       &DoSetPathTraitL,
       
  1945                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  1946                       aElementHandle,
       
  1947                       aAttributeTypeId,
       
  1948                       aPathHandle);
       
  1949         }
       
  1950     }
       
  1951     M2GGeneral::CheckErrorCode(aJni, err);
       
  1952     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - end");
       
  1953 }
       
  1954 
       
  1955 // -----------------------------------------------------------------------------
       
  1956 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setRectTrait
       
  1957 // -----------------------------------------------------------------------------
       
  1958 /**
       
  1959  * Calls MM2GSVGProxy::SetRectTraitL method.
       
  1960  * @since Series S60 3.0
       
  1961  * @param aProxy Proxy instance.
       
  1962  * @param aElementHandle Element handle
       
  1963  * @param aAttributeTypeId Attribute type id
       
  1964  * @param aMatrixData -
       
  1965  */
       
  1966 LOCAL_C void DoSetRectTraitL(
       
  1967     MM2GSVGProxy* aProxy,
       
  1968     TInt aElementHandle,
       
  1969     TInt16 aAttributeTypeId,
       
  1970     TM2GRectData* aRect)
       
  1971 {
       
  1972     aProxy->SetRectTraitL(
       
  1973         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1974         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1975         *aRect);
       
  1976 }
       
  1977 /**
       
  1978  * JNI method
       
  1979  */
       
  1980 JNIEXPORT void JNICALL
       
  1981 Java_com_nokia_microedition_m2g_M2GSVGElement__1setRectTrait(
       
  1982     JNIEnv* aJni,
       
  1983     jclass,
       
  1984     jint aEventSourceHandle,
       
  1985     jint aSvgProxyHandle,
       
  1986     jint aElementHandle,
       
  1987     jshort aAttributeTypeId,
       
  1988     jfloat aX, jfloat aY, jfloat aWidth, jfloat aHeight,
       
  1989     jboolean aUiToolKit)
       
  1990 {
       
  1991     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setRectTrait - begin");
       
  1992     TM2GRectData rect;
       
  1993     rect[ 0 ] = aX;
       
  1994     rect[ 1 ] = aY;
       
  1995     rect[ 2 ] = aWidth;
       
  1996     rect[ 3 ] = aHeight;
       
  1997     TInt err = KM2GNotOk;
       
  1998     if (aUiToolKit)  // If eSWT is the current toolkit
       
  1999     {
       
  2000         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  2001         if (client && aSvgProxyHandle)
       
  2002         {
       
  2003             typedef void (MM2GSVGProxy::*pSetRectTraitL)(const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TM2GRectData&);
       
  2004             pSetRectTraitL SetRectTraitL = &MM2GSVGProxy::SetRectTraitL;
       
  2005             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  2006             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  2007             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  2008             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TM2GRectData& >SetRectTrait(
       
  2009                 *aProxy,
       
  2010                 SetRectTraitL,
       
  2011                 lElementHandle,
       
  2012                 lAttrType,
       
  2013                 rect
       
  2014             );
       
  2015             err = client->Execute(SetRectTrait);
       
  2016         }
       
  2017     }
       
  2018     else
       
  2019     {
       
  2020         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  2021         if (eventSource && aSvgProxyHandle)
       
  2022         {
       
  2023             err = eventSource->ExecuteTrap(
       
  2024                       &DoSetRectTraitL,
       
  2025                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  2026                       aElementHandle,
       
  2027                       aAttributeTypeId,
       
  2028                       &rect);
       
  2029         }
       
  2030     }
       
  2031     M2GGeneral::CheckErrorCode(aJni, err);
       
  2032     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - end");
       
  2033 }
       
  2034 
       
  2035 // -----------------------------------------------------------------------------
       
  2036 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setStringTrait
       
  2037 // -----------------------------------------------------------------------------
       
  2038 /**
       
  2039  * Calls MM2GSVGProxy::SetStringTraitL method.
       
  2040  * @since Series S60 3.0
       
  2041  * @param aElementHandle Element handle
       
  2042  * @param aAttributeTypeId Attribute type id
       
  2043  * @param aString -
       
  2044  */
       
  2045 LOCAL_C void DoSetStringTraitL(
       
  2046     MM2GSVGProxy* aProxy,
       
  2047     TInt aElementHandle,
       
  2048     TInt16 aAttributeTypeId,
       
  2049     TPtrC16* aStr)
       
  2050 {
       
  2051     aProxy->SetStringTraitL(
       
  2052         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  2053         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  2054         *aStr);
       
  2055 }
       
  2056 /**
       
  2057  * JNI method
       
  2058  */
       
  2059 JNIEXPORT void JNICALL
       
  2060 Java_com_nokia_microedition_m2g_M2GSVGElement__1setStringTrait(
       
  2061     JNIEnv* aJni,
       
  2062     jclass,
       
  2063     jint aEventSourceHandle,
       
  2064     jint aSvgProxyHandle,
       
  2065     jint aElementHandle,
       
  2066     jshort aAttributeTypeId,
       
  2067     jstring aValue,
       
  2068     jboolean aUiToolKit)
       
  2069 {
       
  2070     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - begin");
       
  2071     RJString str(*aJni, aValue);
       
  2072     TInt err = KM2GNotOk;
       
  2073     if (aUiToolKit)  // If eSWT is the current toolkit
       
  2074     {
       
  2075         MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
       
  2076         if (client && aSvgProxyHandle)
       
  2077         {
       
  2078             typedef void (MM2GSVGProxy::*pSetStringTraitL)(const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TPtrC16&);
       
  2079             pSetStringTraitL SetStringTraitL = &MM2GSVGProxy::SetStringTraitL;
       
  2080             MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  2081             TM2GSvgElementHandle lElementHandle = STATIC_CAST(TM2GSvgElementHandle, aElementHandle);
       
  2082             TM2GSvgAttrType lAttrType = STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId);
       
  2083             TPtrC16 lValue=STATIC_CAST(TPtrC16, str);
       
  2084             TMethodWrapper3<MM2GSVGProxy, const TM2GSvgElementHandle&,const TM2GSvgAttrType&,const TPtrC16&  >SetStringTrait(
       
  2085                 *aProxy,
       
  2086                 SetStringTraitL,
       
  2087                 lElementHandle,
       
  2088                 lAttrType,
       
  2089                 lValue
       
  2090             );
       
  2091             err = client->Execute(SetStringTrait);
       
  2092         }
       
  2093     }
       
  2094     else
       
  2095     {
       
  2096         CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
       
  2097         if (eventSource && aSvgProxyHandle)
       
  2098         {
       
  2099             err = eventSource->ExecuteTrap(
       
  2100                       &DoSetStringTraitL,
       
  2101                       JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle),
       
  2102                       aElementHandle,
       
  2103                       aAttributeTypeId,
       
  2104                       STATIC_CAST(TPtrC16*, &str));
       
  2105 
       
  2106         }
       
  2107     }
       
  2108     M2GGeneral::CheckErrorCode(aJni, err);
       
  2109     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - end");
       
  2110 }
       
  2111 
       
  2112 
       
  2113 M2G_NS_END