|
1 /* |
|
2 * Copyright (c) 2006 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: JNI class for TactileFeedback.java. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifdef RD_TACTILE_FEEDBACK |
|
19 |
|
20 #include "com_nokia_mid_ui_TactileFeedback.h" |
|
21 #include "CMIDToolkit.h" |
|
22 #include <touchfeedback.h> |
|
23 #include "CTactileFeedbackInterfaceLCDUI.h" |
|
24 #include "CTactileFeedbackInterfaceESWT.h" |
|
25 |
|
26 #include <aknlayoutscalable_avkon.cdl.h> |
|
27 |
|
28 #include <eswt.h> |
|
29 #include <eswtwidgetscore.h> |
|
30 #include <mswtclient.h> |
|
31 #include <swtcliententry.h> |
|
32 #include <swtfunctor.h> |
|
33 |
|
34 |
|
35 JNIEXPORT jboolean JNICALL Java_com_nokia_mid_ui_TactileFeedback__1isESWT |
|
36 (JNIEnv *, jobject) |
|
37 { |
|
38 MSwtClient* client = NULL; |
|
39 TRAP_IGNORE(client = SWT::CreateClientL()); |
|
40 |
|
41 if (!client) |
|
42 { |
|
43 return false; // LCDUI midlet running |
|
44 } |
|
45 else |
|
46 { |
|
47 return true; // eSWT midlet running |
|
48 } |
|
49 } |
|
50 |
|
51 |
|
52 JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TactileFeedback__1createMTouchFeedbackLCDUI |
|
53 (JNIEnv *, jobject, jint aToolkitHandle) |
|
54 { |
|
55 CMIDToolkit* toolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle); |
|
56 |
|
57 MTactileFeedbackInterface *tfInterface = new CTactileFeedbackInterfaceLCDUI(toolkit); |
|
58 |
|
59 return JavaMakeHandle(tfInterface); |
|
60 } |
|
61 |
|
62 |
|
63 JNIEXPORT jint JNICALL Java_com_nokia_mid_ui_TactileFeedback__1createMTouchFeedbackESWT |
|
64 (JNIEnv *, jobject, jint) |
|
65 { |
|
66 |
|
67 MSwtClient* client = NULL; |
|
68 TRAP_IGNORE(client = SWT::CreateClientL()); |
|
69 |
|
70 MTactileFeedbackInterface *tfInterface = new CTactileFeedbackInterfaceESWT(client); |
|
71 |
|
72 return JavaMakeHandle(tfInterface); |
|
73 } |
|
74 |
|
75 |
|
76 JNIEXPORT jboolean JNICALL Java_com_nokia_mid_ui_TactileFeedback__1isTouchFeedbackSupported |
|
77 (JNIEnv *, jobject, jint aTFInterface) |
|
78 |
|
79 { |
|
80 MTactileFeedbackInterface* tfInterface = JavaUnhand<MTactileFeedbackInterface>(aTFInterface); |
|
81 return tfInterface->IsTouchFeedbackSupported(); |
|
82 } |
|
83 |
|
84 |
|
85 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doDirectFeedback |
|
86 (JNIEnv *, jobject, jint aTFInterface, jint aStyle) |
|
87 { |
|
88 MTactileFeedbackInterface* tfInterface = JavaUnhand<MTactileFeedbackInterface>(aTFInterface); |
|
89 |
|
90 tfInterface->DirectFeedback((TTouchLogicalFeedback)aStyle); |
|
91 } |
|
92 |
|
93 |
|
94 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doRegisterFeedback |
|
95 (JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType, jint aAreaIndex, jint aX, jint aY, jint aWidth, jint aHeight, jint aStyle) |
|
96 { |
|
97 |
|
98 MTactileFeedbackInterface* tfInterface = JavaUnhand<MTactileFeedbackInterface>(aTFInterface); |
|
99 tfInterface->RegisterFeedbackArea((void*)aControlHandle, aControlType, aAreaIndex, aX, aY, aWidth, aHeight, (TTouchLogicalFeedback)aStyle); |
|
100 } |
|
101 |
|
102 |
|
103 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doRemoveFeedback |
|
104 (JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType, jint aAreaIndex) |
|
105 { |
|
106 MTactileFeedbackInterface* tfInterface = JavaUnhand<MTactileFeedbackInterface>(aTFInterface); |
|
107 tfInterface->UnregisterFeedbackArea((void*)aControlHandle, aControlType, aAreaIndex); |
|
108 } |
|
109 |
|
110 |
|
111 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doRemoveFeedbackForControl |
|
112 (JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType) |
|
113 { |
|
114 MTactileFeedbackInterface* tfInterface = JavaUnhand<MTactileFeedbackInterface>(aTFInterface); |
|
115 tfInterface->UnregisterFeedbackForControl((void*)aControlHandle, aControlType); |
|
116 } |
|
117 |
|
118 |
|
119 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_TactileFeedback__1doMoveFeedbackAreaToFirstPriority |
|
120 (JNIEnv *, jobject, jint aTFInterface, jint aControlHandle, jint aControlType, jint aAreaIndex) |
|
121 { |
|
122 MTactileFeedbackInterface* tfInterface = JavaUnhand<MTactileFeedbackInterface>(aTFInterface); |
|
123 tfInterface->MoveAreaToFirstPriority((void*)aControlHandle, aControlType, aAreaIndex); |
|
124 } |
|
125 |
|
126 #endif |