|
1 /* |
|
2 * Copyright (c) 2005-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 methods |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "com_nokia_microedition_m2g_M2GSVGImage.h" |
|
20 #include "MM2GSVGProxy.h" |
|
21 |
|
22 M2G_NS_START |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 |
|
34 // MODULE DATA STRUCTURES |
|
35 |
|
36 // LOCAL FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 // ================================ FUNCTIONS ================================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // Java_com_nokia_microedition_m2g_M2GSVGImage::_dispatchMouseEvent |
|
46 // ----------------------------------------------------------------------------- |
|
47 /** |
|
48 * Calls MM2GSVGProxy::DispatchMouseEventL method. |
|
49 * @since Series S60 3.0 |
|
50 * @param aProxy Proxy instance. |
|
51 * @param aDocumentHandle Document handle. |
|
52 * @param aX X coordinate. |
|
53 * @param aY Y coordinate |
|
54 * @param aElementHandle Target element handle |
|
55 */ |
|
56 JNIEXPORT jint JNICALL |
|
57 Java_com_nokia_microedition_m2g_M2GSVGImage__1dispatchMouseEvent( |
|
58 JNIEnv* aJni, |
|
59 jclass, |
|
60 jint aSvgProxyHandle, |
|
61 jint aDocumentHandle, jint aX, jint aY) |
|
62 { |
|
63 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent - begin"); |
|
64 |
|
65 TInt elementHandle = M2G_INVALID_HANDLE; |
|
66 TInt err = KM2GNotOk; |
|
67 |
|
68 M2G_DO_LOCK |
|
69 if (aSvgProxyHandle) |
|
70 { |
|
71 MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
72 TRAP(err, aProxy->DispatchMouseEventL( |
|
73 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
74 aX, aY, elementHandle); ); |
|
75 } |
|
76 M2G_DO_UNLOCK(aJni) |
|
77 |
|
78 M2GGeneral::CheckErrorCode(aJni, err); |
|
79 |
|
80 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent: %d - end", elementHandle); |
|
81 return elementHandle; |
|
82 } |
|
83 // ----------------------------------------------------------------------------- |
|
84 // Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOn |
|
85 // ----------------------------------------------------------------------------- |
|
86 /** |
|
87 * Calls MM2GSVGProxy::FocusOnL method. |
|
88 * @since Series S60 3.1 |
|
89 * @param aProxy Proxy instance. |
|
90 * @param aDocumentHandle Document handle. |
|
91 * @param aElementHandle Target element handle |
|
92 * JNI method |
|
93 */ |
|
94 JNIEXPORT void JNICALL |
|
95 Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOn( |
|
96 JNIEnv* /* aJni */, |
|
97 jclass, |
|
98 jint aSvgProxyHandle, |
|
99 jint aDocumentHandle, jint aElementHandle) |
|
100 { |
|
101 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn - begin"); |
|
102 |
|
103 // TInt elementHandle = M2G_INVALID_HANDLE; |
|
104 TInt err = KM2GNotOk; |
|
105 |
|
106 if (aSvgProxyHandle) |
|
107 { |
|
108 MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
109 TRAP(err, aProxy->FocusOnL( |
|
110 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
111 STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); ); |
|
112 } |
|
113 |
|
114 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn: %d - end", err); |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOut |
|
120 // ----------------------------------------------------------------------------- |
|
121 /** |
|
122 * Calls MM2GSVGProxy::FocusOutL method. |
|
123 * @since Series S60 3.1 |
|
124 * @param aProxy Proxy instance. |
|
125 * @param aDocumentHandle Document handle. |
|
126 * @param aElementHandle Target element handle |
|
127 * JNI method |
|
128 */ |
|
129 JNIEXPORT void JNICALL |
|
130 Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOut( |
|
131 JNIEnv* /* aJni */, |
|
132 jclass, |
|
133 jint aSvgProxyHandle, |
|
134 jint aDocumentHandle, jint aElementHandle) |
|
135 { |
|
136 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut - begin"); |
|
137 TInt err = KM2GNotOk; |
|
138 |
|
139 if (aSvgProxyHandle) |
|
140 { |
|
141 MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
142 TRAP(err,aProxy->FocusOutL( |
|
143 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
144 STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); ); |
|
145 } |
|
146 |
|
147 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut: %d - end", err); |
|
148 |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem |
|
153 // EXTENSION |
|
154 // ----------------------------------------------------------------------------- |
|
155 /** |
|
156 * Calls MM2GSVGProxy::GetExternalListItemL method. |
|
157 * @since Series S60 3.0 |
|
158 * @param aProxy Proxy instance. |
|
159 * @param aDocumentHandle Document pointer. |
|
160 * @param aIndex External item index. |
|
161 * @param aItem External item |
|
162 * @throws Exception if not ok |
|
163 * JNI method |
|
164 */ |
|
165 JNIEXPORT jstring JNICALL |
|
166 Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListItem( |
|
167 JNIEnv* aJni, |
|
168 jclass, |
|
169 jint aSvgProxyHandle, |
|
170 jint aDocumentHandle, |
|
171 jint aIndex) |
|
172 { |
|
173 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListItem - begin"); |
|
174 TPtrC16 lItem; |
|
175 TInt err = KM2GNotOk; |
|
176 |
|
177 M2G_DO_LOCK |
|
178 if (aSvgProxyHandle) |
|
179 { |
|
180 MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
181 TRAP(err, aProxy->GetExternalListItemL( |
|
182 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
183 aIndex, |
|
184 lItem); ); |
|
185 } |
|
186 M2G_DO_UNLOCK(aJni) |
|
187 |
|
188 if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && (lItem.Length() > 0)) |
|
189 { |
|
190 return CreateJavaString(*aJni, lItem); |
|
191 } |
|
192 |
|
193 return NULL; |
|
194 } |
|
195 // ----------------------------------------------------------------------------- |
|
196 // Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListSize |
|
197 // ----------------------------------------------------------------------------- |
|
198 /** |
|
199 * Calls MM2GSVGProxy::GetExternalListItemL method. |
|
200 * @since Series S60 3.0 |
|
201 * @param aProxy Proxy instance. |
|
202 * @param aDocumentHandle Document handle. |
|
203 * @param aListSz List size to be returned. |
|
204 */ |
|
205 JNIEXPORT TInt JNICALL |
|
206 Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListSize( |
|
207 JNIEnv* aJni, |
|
208 jclass, |
|
209 jint aSvgProxyHandle, |
|
210 jint aDocumentHandle) |
|
211 { |
|
212 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize - begin"); |
|
213 |
|
214 // TInt elementHandle = M2G_INVALID_HANDLE; |
|
215 TInt err = KM2GNotOk; |
|
216 TInt listSz = 0; |
|
217 |
|
218 M2G_DO_LOCK |
|
219 if (aSvgProxyHandle) |
|
220 { |
|
221 MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
222 TRAP(err, aProxy->GetExternalListSizeL( |
|
223 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), listSz); ); |
|
224 } |
|
225 M2G_DO_UNLOCK(aJni) |
|
226 |
|
227 M2GGeneral::CheckErrorCode(aJni, err); |
|
228 |
|
229 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize: %d - end", listSz); |
|
230 return listSz; |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------------------------- |
|
234 // Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem |
|
235 // ----------------------------------------------------------------------------- |
|
236 /** |
|
237 * Calls MM2GSVGProxy::GetExternalListItemL method. |
|
238 * @since Series S60 3.0 |
|
239 * @param aProxy Proxy instance. |
|
240 * @param aDocumentHandle Document pointer. |
|
241 * @param aIndex Index. |
|
242 * @param aStrBuf Returns a string |
|
243 * @throws Exception if not ok |
|
244 * JNI method |
|
245 */ |
|
246 JNIEXPORT void JNICALL |
|
247 Java_com_nokia_microedition_m2g_M2GSVGImage__1initViewport( |
|
248 JNIEnv* aJni, |
|
249 jclass, |
|
250 jint aSvgProxyHandle, |
|
251 jint aDocumentHandle) |
|
252 { |
|
253 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport - begin"); |
|
254 // TInt elementHandle = M2G_INVALID_HANDLE; |
|
255 TInt err = KM2GNotOk; |
|
256 |
|
257 if (aSvgProxyHandle) |
|
258 { |
|
259 MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
260 TRAP(err, aProxy->InitViewportL( |
|
261 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle)); ); |
|
262 } |
|
263 M2GGeneral::CheckErrorCode(aJni, err); |
|
264 |
|
265 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport: %d - end", err); |
|
266 |
|
267 } |
|
268 |
|
269 M2G_NS_END |