diff -r f5050f1da672 -r 04becd199f91 javauis/lcdui_akn/javalcdui/src.nokialcdui/CMIDTactileFeedback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/lcdui_akn/javalcdui/src.nokialcdui/CMIDTactileFeedback.cpp Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2006 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: JNI class for TactileFeedback.java. +* +*/ + +#ifdef RD_TACTILE_FEEDBACK + +#include "com_nokia_mid_ui_TactileFeedback.h" +#include "CMIDToolkit.h" +#include +#include "CTactileFeedbackInterfaceLCDUI.h" +#include "CTactileFeedbackInterfaceESWT.h" + +#include + +#include +#include +#include +#include +#include + + +JNIEXPORT jboolean JNICALL Java_com_nokia_mid_ui_TactileFeedback__1isESWT +(JNIEnv *, jobject) +{ + MSwtClient* client = NULL; + TRAP_IGNORE(client = SWT::CreateClientL()); + + if (!client) + { + return false; // LCDUI midlet running + } + else + { + return true; // eSWT midlet running + } +} + + +JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TactileFeedback__1createMTouchFeedbackLCDUI +(JNIEnv *, jobject, jint aToolkitHandle) +{ + CMIDToolkit* toolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle); + + MTactileFeedbackInterface *tfInterface = new CTactileFeedbackInterfaceLCDUI(toolkit); + + return JavaMakeHandle(tfInterface); +} + + +JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TactileFeedback__1createMTouchFeedbackESWT +(JNIEnv *, jobject, jint) +{ + + MSwtClient* client = NULL; + TRAP_IGNORE(client = SWT::CreateClientL()); + + MTactileFeedbackInterface *tfInterface = new CTactileFeedbackInterfaceESWT(client); + + return JavaMakeHandle(tfInterface); +} + + +JNIEXPORT jboolean JNICALL Java_com_nokia_mid_ui_TactileFeedback__1isTouchFeedbackSupported +(JNIEnv *, jobject, jint aTFInterface) + +{ + MTactileFeedbackInterface* tfInterface = JavaUnhand(aTFInterface); + return tfInterface->IsTouchFeedbackSupported(); +} + + +JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doDirectFeedback +(JNIEnv *, jobject, jint aTFInterface, jint aStyle) +{ + MTactileFeedbackInterface* tfInterface = JavaUnhand(aTFInterface); + + tfInterface->DirectFeedback((TTouchLogicalFeedback)aStyle); +} + + +JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doRegisterFeedback +(JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType, jint aAreaIndex, jint aX, jint aY, jint aWidth, jint aHeight, jint aStyle) +{ + + MTactileFeedbackInterface* tfInterface = JavaUnhand(aTFInterface); + tfInterface->RegisterFeedbackArea((void*)aControlHandle, aControlType, aAreaIndex, aX, aY, aWidth, aHeight, (TTouchLogicalFeedback)aStyle); +} + + +JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doRemoveFeedback +(JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType, jint aAreaIndex) +{ + MTactileFeedbackInterface* tfInterface = JavaUnhand(aTFInterface); + tfInterface->UnregisterFeedbackArea((void*)aControlHandle, aControlType, aAreaIndex); +} + + +JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doRemoveFeedbackForControl +(JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType) +{ + MTactileFeedbackInterface* tfInterface = JavaUnhand(aTFInterface); + tfInterface->UnregisterFeedbackForControl((void*)aControlHandle, aControlType); +} + + +JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doMoveFeedbackAreaToFirstPriority +(JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType, jint aAreaIndex) +{ + MTactileFeedbackInterface* tfInterface = JavaUnhand(aTFInterface); + tfInterface->MoveAreaToFirstPriority((void*)aControlHandle, aControlType, aAreaIndex); +} + +#endif