javauis/lcdui_akn/javalcdui/src/Spacer.cpp
branchRCL_3
changeset 26 2455ef1f5bbc
parent 14 04becd199f91
equal deleted inserted replaced
25:ae942d28ec0e 26:2455ef1f5bbc
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "CMIDToolkit.h"
       
    21 #include "MIDUtils.h"
       
    22 #include "javax_microedition_lcdui_Spacer.h"
       
    23 
       
    24 LOCAL_C void CreateL(CMIDToolkit* aToolkit,TInt* aHandle,TSize aSize)
       
    25 {
       
    26     MMIDSpacer* spacer = aToolkit->ComponentFactory()->CreateSpacerL(aSize);
       
    27     CleanupDisposePushL(spacer);
       
    28     *aHandle = aToolkit->RegisterComponentL(spacer, NULL);
       
    29     CleanupPopComponent(spacer);
       
    30 }
       
    31 JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Spacer__1create
       
    32 (JNIEnv*,jobject,jint aToolkit,jint aWidth,jint aHeight)
       
    33 {
       
    34     CMIDToolkit* toolkit = JavaUnhand<CMIDToolkit>(aToolkit);
       
    35     TInt h = 0;
       
    36     TInt err = toolkit->ExecuteTrap(&CreateL,toolkit,&h,TSize((TInt)aWidth,(TInt)aHeight));
       
    37     return err == KErrNone ? h : err;
       
    38 }
       
    39 
       
    40 LOCAL_C void SetMinimumSizeL(MMIDSpacer* aSpacer,TInt aWidth,TInt aHeight)
       
    41 {
       
    42     TSize size(aWidth,aHeight);
       
    43     aSpacer->SetMinimumSizeL(size);
       
    44 }
       
    45 JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Spacer__1setMinimumSize
       
    46 (JNIEnv*,jobject,jint aSpacer,jint aToolkit,jint aWidth,jint aHeight)
       
    47 {
       
    48     MMIDSpacer* spacer = MIDUnhandObject<MMIDSpacer>(aSpacer);
       
    49     CMIDToolkit* toolkit = JavaUnhand<CMIDToolkit>(aToolkit);
       
    50     return toolkit->ExecuteTrap(&SetMinimumSizeL,spacer,(TInt)aWidth,(TInt)aHeight);
       
    51 }
       
    52 
       
    53