javauis/lcdui_akn/javalcdui/src/Spacer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 13 Oct 2010 14:23:59 +0300
branchRCL_3
changeset 83 26b2b12093af
parent 19 04becd199f91
permissions -rw-r--r--
Revision: v2.2.17 Kit: 201041

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/



#include "CMIDToolkit.h"
#include "MIDUtils.h"
#include "javax_microedition_lcdui_Spacer.h"

LOCAL_C void CreateL(CMIDToolkit* aToolkit,TInt* aHandle,TSize aSize)
{
    MMIDSpacer* spacer = aToolkit->ComponentFactory()->CreateSpacerL(aSize);
    CleanupDisposePushL(spacer);
    *aHandle = aToolkit->RegisterComponentL(spacer, NULL);
    CleanupPopComponent(spacer);
}
JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Spacer__1create
(JNIEnv*,jobject,jint aToolkit,jint aWidth,jint aHeight)
{
    CMIDToolkit* toolkit = JavaUnhand<CMIDToolkit>(aToolkit);
    TInt h = 0;
    TInt err = toolkit->ExecuteTrap(&CreateL,toolkit,&h,TSize((TInt)aWidth,(TInt)aHeight));
    return err == KErrNone ? h : err;
}

LOCAL_C void SetMinimumSizeL(MMIDSpacer* aSpacer,TInt aWidth,TInt aHeight)
{
    TSize size(aWidth,aHeight);
    aSpacer->SetMinimumSizeL(size);
}
JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Spacer__1setMinimumSize
(JNIEnv*,jobject,jint aSpacer,jint aToolkit,jint aWidth,jint aHeight)
{
    MMIDSpacer* spacer = MIDUnhandObject<MMIDSpacer>(aSpacer);
    CMIDToolkit* toolkit = JavaUnhand<CMIDToolkit>(aToolkit);
    return toolkit->ExecuteTrap(&SetMinimumSizeL,spacer,(TInt)aWidth,(TInt)aHeight);
}