javauis/mmapi_akn/baseline/src/itemdisplay.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14: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 class has JNI wrappers for CMMAItemDisplay
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <jutils.h>
       
    20 #include "com_nokia_microedition_media_control_VideoItem.h"
       
    21 #include "cmmaeventsource.h"
       
    22 #include "cmmaitemdisplay.h"
       
    23 
       
    24 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1sizeChanged
       
    25 (JNIEnv*, jobject,
       
    26  jint aEventSourceHandle,
       
    27  jint aDisplayHandle,
       
    28  jint aWidth,
       
    29  jint aHeight)
       
    30 {
       
    31     CMMAItemDisplay* itemDisplay = JavaUnhand< CMMAItemDisplay >(aDisplayHandle);
       
    32     CMMAEventSource* eventSource = JavaUnhand< CMMAEventSource >(aEventSourceHandle);
       
    33 
       
    34     __ASSERT_DEBUG(itemDisplay != NULL,
       
    35                    User::Panic(_L("itemdisplay::control is null"),
       
    36                                KErrArgument));
       
    37     __ASSERT_DEBUG(eventSource != NULL,
       
    38                    User::Panic(_L("itemdisplay::eventsource is null"),
       
    39                                KErrArgument));
       
    40 
       
    41     TInt err = eventSource->ExecuteTrap(&CMMAItemDisplay::SizeChangedL,
       
    42                                         itemDisplay,
       
    43                                         aWidth,
       
    44                                         aHeight);
       
    45 
       
    46     return err;
       
    47 }
       
    48 
       
    49 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getMinContentWidth
       
    50 (JNIEnv*, jobject,
       
    51  jint aEventSourceHandle,
       
    52  jint aDisplayHandle)
       
    53 {
       
    54     CMMAItemDisplay* itemDisplay = JavaUnhand< CMMAItemDisplay >(aDisplayHandle);
       
    55     CMMAEventSource* eventSource = JavaUnhand< CMMAEventSource >(aEventSourceHandle);
       
    56     TSize size;
       
    57     eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
       
    58                           itemDisplay,
       
    59                           (TSize*)&size);
       
    60     return size.iWidth;
       
    61 }
       
    62 
       
    63 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getMinContentHeight
       
    64 (JNIEnv*, jobject,
       
    65  jint aEventSourceHandle,
       
    66  jint aDisplayHandle)
       
    67 {
       
    68     CMMAItemDisplay* itemDisplay = JavaUnhand< CMMAItemDisplay >(aDisplayHandle);
       
    69     CMMAEventSource* eventSource = JavaUnhand< CMMAEventSource >(aEventSourceHandle);
       
    70 
       
    71     TSize size;
       
    72     eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
       
    73                           itemDisplay,
       
    74                           (TSize*)&size);
       
    75     return size.iHeight;
       
    76 }
       
    77 
       
    78 
       
    79 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getPrefContentHeight
       
    80 (JNIEnv*, jobject,
       
    81  jint aEventSourceHandle,
       
    82  jint aDisplayHandle,
       
    83  jint /*aTentative*/)  // tentative value is ignored because current
       
    84 // implementation returns always -1
       
    85 {
       
    86     CMMAItemDisplay* itemDisplay = JavaUnhand< CMMAItemDisplay >(aDisplayHandle);
       
    87     CMMAEventSource* eventSource = JavaUnhand< CMMAEventSource >(aEventSourceHandle);
       
    88 
       
    89     TSize size;
       
    90     eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
       
    91                           itemDisplay,
       
    92                           (TSize*)&size);
       
    93     return size.iHeight;
       
    94 }
       
    95 
       
    96 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getPrefContentWidth
       
    97 (JNIEnv*, jobject,
       
    98  jint aEventSourceHandle,
       
    99  jint aDisplayHandle,
       
   100  jint /*aTentative*/)  // tentative value is ignored because current
       
   101 // implementation returns always -1
       
   102 {
       
   103     CMMAItemDisplay* itemDisplay = JavaUnhand< CMMAItemDisplay >(aDisplayHandle);
       
   104     CMMAEventSource* eventSource = JavaUnhand< CMMAEventSource >(aEventSourceHandle);
       
   105 
       
   106     TSize size;
       
   107     eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
       
   108                           itemDisplay,
       
   109                           (TSize*)&size);
       
   110     return size.iWidth;
       
   111 }
       
   112 
       
   113 
       
   114 //  END OF FILE