diff -r f5050f1da672 -r 04becd199f91 javauis/lcdui_akn/javalcdui/src/Item.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/lcdui_akn/javalcdui/src/Item.cpp Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 1999-2001 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_Item.h" + +/* + * Server-side methods + */ +LOCAL_C void SetLabelL(jint aItem,const TDesC* aLabel) +{ + MIDUnhand(aItem)->SetLabelL(*aLabel); +} + +LOCAL_C void SetLayoutL(jint aItem,MMIDItem::TLayout aLayout) +{ + MIDUnhand(aItem)->SetLayoutL(aLayout); +} + +LOCAL_C void MinimumSize(jint aItem,TSize* aSize) +{ + *aSize = MIDUnhand(aItem)->MinimumSize(); +} + +LOCAL_C void PreferredSize(jint aItem,TSize* aSize) +{ + *aSize = MIDUnhand(aItem)->PreferredSize(); +} + +LOCAL_C void SetPreferredSizeL(jint aItem, TInt aWidth, TInt aHeight) +{ + TSize size(aWidth,aHeight); + MIDUnhand(aItem)->SetPreferredSizeL(size); +} + +LOCAL_C void AddCommandL(jint aItem, jint aCommand) +{ + MIDUnhand(aItem)->AddCommandL(MIDUnhand(aCommand)); +} + +LOCAL_C void RemoveCommand(jint aItem, jint aCommand) +{ + MIDUnhand(aItem)->RemoveCommand(MIDUnhand(aCommand)); +} + +LOCAL_C void SetDefaultCommand(jint aItem, jint aCommand) +{ + MIDUnhand(aItem)->SetDefaultCommand(MIDUnhand(aCommand)); +} + +// +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1setLabel +(JNIEnv* aEnv,jobject,jint aItem,jint aToolkit,jstring aLabel) +{ + CMIDToolkit* toolkit = JavaUnhand(aToolkit); + RJString label(*aEnv,aLabel); + return toolkit->ExecuteTrap(&SetLabelL, aItem, (const TDesC*)&label); +} + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1setLayout(JNIEnv*,jobject,jint aItem,jint aToolkit,jint aLayout) +{ + return JavaUnhand(aToolkit)->ExecuteTrap(&SetLayoutL, aItem, (MMIDItem::TLayout)aLayout); +} + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1getMinimumSizeWidth(JNIEnv*,jobject,jint aItem,jint aToolkit) +{ + TSize size; + JavaUnhand(aToolkit)->ExecuteV(&MinimumSize, aItem, &size); + return size.iWidth; +} + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1getMinimumSizeHeight(JNIEnv*,jobject,jint aItem,jint aToolkit) +{ + TSize size; + JavaUnhand(aToolkit)->ExecuteV(&MinimumSize, aItem, &size); + return size.iHeight; +} + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1getPreferredSizeWidth(JNIEnv*, jobject, jint aItem, jint aToolkit) +{ + TSize size; + JavaUnhand(aToolkit)->ExecuteV(&PreferredSize, aItem, &size); + return size.iWidth; +} + + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1getPreferredSizeHeight(JNIEnv*, jobject, jint aItem, jint aToolkit) +{ + TSize size; + JavaUnhand(aToolkit)->ExecuteV(&PreferredSize, aItem, &size); + return size.iHeight; +} + + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1setPreferredSize +(JNIEnv*,jobject,jint aItem,jint aToolkit,jint aWidth,jint aHeight) +{ + return JavaUnhand(aToolkit)->ExecuteTrap(&SetPreferredSizeL, aItem, aWidth, aHeight); +} + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1addCommand +(JNIEnv*,jobject,jint aItem,jint aToolkit,jint aCommand) +{ + return JavaUnhand(aToolkit)->ExecuteTrap(&AddCommandL, aItem, aCommand); +} + +JNIEXPORT jint JNICALL Java_javax_microedition_lcdui_Item__1removeCommand +(JNIEnv*,jobject,jint aItem,jint aToolkit,jint aCommand) +{ + return JavaUnhand(aToolkit)->ExecuteTrap(&RemoveCommand, aItem, aCommand); +} + +JNIEXPORT void JNICALL Java_javax_microedition_lcdui_Item__1setDefaultCommand +(JNIEnv*,jobject,jint aItem,jint aToolkit,jint aCommand) +{ + JavaUnhand(aToolkit)->ExecuteV(&SetDefaultCommand, aItem, aCommand); +}