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