javauis/mmapi_qt/baseline/src/controlcontainer.cpp
branchRCL_3
changeset 25 ae942d28ec0e
equal deleted inserted replaced
24:6c158198356e 25:ae942d28ec0e
       
     1 /*
       
     2 * Copyright (c) 2002 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:  This file contains ControlContainer JNI functions
       
    15 *
       
    16 */
       
    17 
       
    18 #include <logger.h>
       
    19 #include "com_nokia_microedition_media_ControlContainer.h"
       
    20 
       
    21 #include "cmmaplayer.h"
       
    22 #include "cmmacontrol.h"
       
    23 #include "s60commonutils.h"
       
    24 
       
    25 using namespace java::util;
       
    26 
       
    27 //#include "mmapiutils.h"
       
    28 //#include "jutils.h"
       
    29 
       
    30 
       
    31 /**
       
    32  * JNI function
       
    33  */
       
    34 JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlClassName
       
    35 (JNIEnv* aJni, jclass,
       
    36  jint aControlHandle)
       
    37 {
       
    38     CMMAControl* control =
       
    39         reinterpret_cast< CMMAControl* >(aControlHandle);
       
    40 
       
    41     const TDesC& className = control->ClassName();
       
    42 
       
    43     LOG1(EJavaMMAPI, EInfo, "MMA::ControlContainer.cpp::getControlClassName name = %S",
       
    44          className.Ptr());
       
    45 
       
    46     // Create Java String from class name and return it
       
    47     return (className == KNullDesC) ? NULL : S60CommonUtils::NativeToJavaString(*aJni, className);
       
    48 }
       
    49 
       
    50 /**
       
    51  * JNI function
       
    52  */
       
    53 JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_ControlContainer__1getPublicControlClassName
       
    54 (JNIEnv* aJni, jclass,
       
    55  jint aControlHandle)
       
    56 {
       
    57     CMMAControl* control =
       
    58         reinterpret_cast< CMMAControl* >(aControlHandle);
       
    59 
       
    60     const TDesC& className = control->PublicClassName();
       
    61 
       
    62     LOG1(EJavaMMAPI, EInfo, "MMA::ControlContainer.cpp::getPublicControlClassName name = %S",
       
    63          className.Ptr());
       
    64 
       
    65     // Create Java String from class name and return it
       
    66     return (className == KNullDesC) ? NULL : S60CommonUtils::NativeToJavaString(*aJni, className);
       
    67 }
       
    68 
       
    69 /**
       
    70  * JNI function
       
    71  */
       
    72 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlsCount
       
    73 (JNIEnv*, jclass,
       
    74  jint aPlayerHandle)
       
    75 {
       
    76     CMMAPlayer* player =
       
    77         reinterpret_cast< CMMAPlayer *>(aPlayerHandle);
       
    78     LOG1(EJavaMMAPI, EInfo, "MMA::ControlContainer.cpp::getControlsCount count = %d",
       
    79          player->ControlCount());
       
    80     return player->ControlCount();
       
    81 }
       
    82 
       
    83 /**
       
    84  * JNI function
       
    85  */
       
    86 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlHandle
       
    87 (JNIEnv*, jclass,
       
    88  jint aPlayerHandle, jint aControlIndex)
       
    89 {
       
    90     CMMAPlayer* player =
       
    91         reinterpret_cast< CMMAPlayer *>(aPlayerHandle);
       
    92 
       
    93     // Get control and make Java handle
       
    94     return reinterpret_cast<TInt>(player->Control(aControlIndex));
       
    95 }
       
    96 
       
    97 //  END OF FILE