|
1 /* |
|
2 * Copyright (c) 2009 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: This main entry point of Java processes. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include<QWidget> |
|
21 #include <coecntrl.h> |
|
22 #include <touchfeedback.h> |
|
23 #include <com_nokia_mid_ui_internal_OS.h> |
|
24 |
|
25 static CCoeControl* convertToSymbian(QWidget* window) |
|
26 { |
|
27 CCoeControl* control = 0; |
|
28 if (window && window->winId()) |
|
29 { |
|
30 control = reinterpret_cast<CCoeControl*>(window->winId()); |
|
31 } |
|
32 return control; |
|
33 } |
|
34 |
|
35 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_internal_OS_MTouchFeedback_1InstantFeedback |
|
36 (JNIEnv *, jclass, jint aStyle) |
|
37 { |
|
38 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
39 if (feedback) |
|
40 { |
|
41 feedback->InstantFeedback(static_cast<TTouchLogicalFeedback>(aStyle)); |
|
42 } |
|
43 } |
|
44 |
|
45 JNIEXPORT jboolean JNICALL Java_com_nokia_mid_ui_internal_OS_MTouchFeedback_1TouchFeedbackSupported |
|
46 (JNIEnv *, jclass) |
|
47 { |
|
48 jboolean enabled = JNI_FALSE; |
|
49 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
50 if (feedback) |
|
51 { |
|
52 enabled = feedback->TouchFeedbackSupported() ? JNI_TRUE : JNI_FALSE; |
|
53 } |
|
54 return enabled; |
|
55 } |
|
56 |
|
57 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_internal_OS_MTouchFeedback_1SetFeedbackArea |
|
58 (JNIEnv *, jclass, jint aControl, jint aAreaIndex, jint aX, jint aY, jint aWidth, jint aHeight, jint aStyle) |
|
59 { |
|
60 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
61 if (feedback) |
|
62 { |
|
63 CCoeControl* control = convertToSymbian(reinterpret_cast<QWidget*>(aControl)); |
|
64 TRect feedbackRect(aX, aY, aX + aWidth, aY + aHeight); |
|
65 feedback->SetFeedbackArea(control, |
|
66 static_cast<TUint32>(aAreaIndex), |
|
67 feedbackRect, |
|
68 static_cast<TTouchLogicalFeedback>(aStyle), |
|
69 ETouchEventStylusDown); |
|
70 } |
|
71 } |
|
72 |
|
73 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_internal_OS_MTouchFeedback_1RemoveFeedbackArea |
|
74 (JNIEnv *, jclass, jint aControl, jint aAreaIndex) |
|
75 { |
|
76 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
77 if (feedback) |
|
78 { |
|
79 CCoeControl* control = convertToSymbian(reinterpret_cast<QWidget*>(aControl)); |
|
80 feedback->RemoveFeedbackArea(control, aAreaIndex); |
|
81 } |
|
82 } |
|
83 |
|
84 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_internal_OS_MTouchFeedback_1RemoveFeedbackForControl |
|
85 (JNIEnv *, jclass, jint aControl) |
|
86 { |
|
87 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
88 if (feedback) |
|
89 { |
|
90 CCoeControl* control = convertToSymbian(reinterpret_cast<QWidget*>(aControl)); |
|
91 feedback->RemoveFeedbackForControl(control); |
|
92 } |
|
93 } |
|
94 |
|
95 JNIEXPORT void JNICALL Java_com_nokia_mid_ui_internal_OS_MTouchFeedback_1MoveFeedbackAreaToFirstPriority |
|
96 (JNIEnv *, jclass, jint aControl, jint aAreaIndex) |
|
97 { |
|
98 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
99 if (feedback) |
|
100 { |
|
101 CCoeControl* control = convertToSymbian(reinterpret_cast<QWidget*>(aControl)); |
|
102 feedback->MoveFeedbackAreaToFirstPriority(control, static_cast<TUint32>(aAreaIndex)); |
|
103 } |
|
104 } |
|
105 |
|
106 |
|
107 |