javauis/mmapi_akn/baseline/src/controlcontainer.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     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 <jdebug.h>
       
    19 #include "com_nokia_microedition_media_ControlContainer.h"
       
    20 
       
    21 #include "cmmaplayer.h"
       
    22 #include "cmmacontrol.h"
       
    23 
       
    24 
       
    25 /**
       
    26  * JNI function
       
    27  */
       
    28 JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlClassName
       
    29 (JNIEnv* aJni, jclass,
       
    30  jint aControlHandle)
       
    31 {
       
    32     CMMAControl* control =
       
    33         JavaUnhand< CMMAControl >(aControlHandle);
       
    34 
       
    35     const TDesC& className = control->ClassName();
       
    36 
       
    37     DEBUG_STR("MMA::ControlContainer.cpp::getControlClassName name = %S",
       
    38               className);
       
    39 
       
    40     // Create Java String from class name and return it
       
    41     return (className == KNullDesC) ? NULL : CreateJavaString(*aJni, className);
       
    42 }
       
    43 
       
    44 /**
       
    45  * JNI function
       
    46  */
       
    47 JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_ControlContainer__1getPublicControlClassName
       
    48 (JNIEnv* aJni, jclass,
       
    49  jint aControlHandle)
       
    50 {
       
    51     CMMAControl* control =
       
    52         JavaUnhand< CMMAControl >(aControlHandle);
       
    53 
       
    54     const TDesC& className = control->PublicClassName();
       
    55 
       
    56     DEBUG_STR("MMA::ControlContainer.cpp::getPublicControlClassName name = %S",
       
    57               className);
       
    58 
       
    59     // Create Java String from class name and return it
       
    60     return (className == KNullDesC) ? NULL : CreateJavaString(*aJni, className);
       
    61 }
       
    62 
       
    63 /**
       
    64  * JNI function
       
    65  */
       
    66 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlsCount
       
    67 (JNIEnv*, jclass,
       
    68  jint aPlayerHandle)
       
    69 {
       
    70     CMMAPlayer* player =
       
    71         JavaUnhand< CMMAPlayer >(aPlayerHandle);
       
    72     DEBUG_INT("MMA::ControlContainer.cpp::getControlsCount count = %d",
       
    73               player->ControlCount());
       
    74     return player->ControlCount();
       
    75 }
       
    76 
       
    77 /**
       
    78  * JNI function
       
    79  */
       
    80 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlHandle
       
    81 (JNIEnv*, jclass,
       
    82  jint aPlayerHandle, jint aControlIndex)
       
    83 {
       
    84     CMMAPlayer* player =
       
    85         JavaUnhand< CMMAPlayer >(aPlayerHandle);
       
    86 
       
    87     // Get control and make Java handle
       
    88     return JavaMakeHandle(player->Control(aControlIndex));
       
    89 }
       
    90 
       
    91 //  END OF FILE