80
|
1 |
/*
|
87
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
80
|
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;
|
87
|
67 |
|
80
|
68 |
M2G_DO_LOCK
|
|
69 |
if (aSvgProxyHandle)
|
87
|
70 |
{
|
|
71 |
MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
|
|
72 |
TRAP(err, aProxy->DispatchMouseEventL(
|
|
73 |
STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
|
|
74 |
aX, aY, elementHandle););
|
|
75 |
}
|
80
|
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 |
|
87
|
103 |
TInt err = KM2GNotOk;
|
|
104 |
|
|
105 |
if (aSvgProxyHandle)
|
|
106 |
{
|
|
107 |
MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
|
|
108 |
TRAP(err, aProxy->FocusOnL(
|
80
|
109 |
STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
|
87
|
110 |
STATIC_CAST(TM2GSvgElementHandle, aElementHandle)););
|
|
111 |
}
|
|
112 |
|
80
|
113 |
M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn: %d - end", err);
|
|
114 |
}
|
|
115 |
|
|
116 |
|
|
117 |
// -----------------------------------------------------------------------------
|
|
118 |
// Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOut
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
/**
|
|
121 |
* Calls MM2GSVGProxy::FocusOutL method.
|
|
122 |
* @since Series S60 3.1
|
|
123 |
* @param aProxy Proxy instance.
|
|
124 |
* @param aDocumentHandle Document handle.
|
|
125 |
* @param aElementHandle Target element handle
|
|
126 |
* JNI method
|
|
127 |
*/
|
|
128 |
JNIEXPORT void JNICALL
|
|
129 |
Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOut(
|
|
130 |
JNIEnv* /* aJni */,
|
|
131 |
jclass,
|
|
132 |
jint aSvgProxyHandle,
|
|
133 |
jint aDocumentHandle, jint aElementHandle)
|
|
134 |
{
|
|
135 |
M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut - begin");
|
87
|
136 |
TInt err = KM2GNotOk;
|
|
137 |
|
80
|
138 |
if (aSvgProxyHandle)
|
87
|
139 |
{
|
80
|
140 |
MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
|
|
141 |
TRAP(err,aProxy->FocusOutL(
|
87
|
142 |
STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
|
|
143 |
STATIC_CAST(TM2GSvgElementHandle, aElementHandle)););
|
|
144 |
}
|
80
|
145 |
|
|
146 |
M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut: %d - end", err);
|
|
147 |
|
|
148 |
}
|
|
149 |
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem
|
|
152 |
// EXTENSION
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
/**
|
|
155 |
* Calls MM2GSVGProxy::GetExternalListItemL method.
|
|
156 |
* @since Series S60 3.0
|
|
157 |
* @param aProxy Proxy instance.
|
|
158 |
* @param aDocumentHandle Document pointer.
|
|
159 |
* @param aIndex External item index.
|
|
160 |
* @param aItem External item
|
|
161 |
* @throws Exception if not ok
|
|
162 |
* JNI method
|
|
163 |
*/
|
|
164 |
JNIEXPORT jstring JNICALL
|
|
165 |
Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListItem(
|
|
166 |
JNIEnv* aJni,
|
|
167 |
jclass,
|
|
168 |
jint aSvgProxyHandle,
|
|
169 |
jint aDocumentHandle,
|
|
170 |
jint aIndex)
|
|
171 |
{
|
|
172 |
M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListItem - begin");
|
|
173 |
TPtrC16 lItem;
|
|
174 |
TInt err = KM2GNotOk;
|
87
|
175 |
|
80
|
176 |
M2G_DO_LOCK
|
|
177 |
if (aSvgProxyHandle)
|
87
|
178 |
{
|
|
179 |
MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
|
|
180 |
TRAP(err, aProxy->GetExternalListItemL(
|
|
181 |
STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
|
|
182 |
aIndex,
|
|
183 |
lItem););
|
|
184 |
}
|
80
|
185 |
M2G_DO_UNLOCK(aJni)
|
|
186 |
|
|
187 |
if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && (lItem.Length() > 0))
|
|
188 |
{
|
|
189 |
return CreateJavaString(*aJni, lItem);
|
|
190 |
}
|
|
191 |
|
|
192 |
return NULL;
|
|
193 |
}
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListSize
|
|
196 |
// -----------------------------------------------------------------------------
|
|
197 |
/**
|
|
198 |
* Calls MM2GSVGProxy::GetExternalListItemL method.
|
|
199 |
* @since Series S60 3.0
|
|
200 |
* @param aProxy Proxy instance.
|
|
201 |
* @param aDocumentHandle Document handle.
|
|
202 |
* @param aListSz List size to be returned.
|
|
203 |
*/
|
|
204 |
JNIEXPORT TInt JNICALL
|
|
205 |
Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListSize(
|
|
206 |
JNIEnv* aJni,
|
|
207 |
jclass,
|
|
208 |
jint aSvgProxyHandle,
|
|
209 |
jint aDocumentHandle)
|
|
210 |
{
|
|
211 |
M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize - begin");
|
|
212 |
|
|
213 |
TInt err = KM2GNotOk;
|
|
214 |
TInt listSz = 0;
|
87
|
215 |
|
80
|
216 |
M2G_DO_LOCK
|
|
217 |
if (aSvgProxyHandle)
|
87
|
218 |
{
|
|
219 |
MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
|
|
220 |
TRAP(err, aProxy->GetExternalListSizeL(
|
|
221 |
STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), listSz););
|
|
222 |
}
|
80
|
223 |
M2G_DO_UNLOCK(aJni)
|
|
224 |
|
|
225 |
M2GGeneral::CheckErrorCode(aJni, err);
|
|
226 |
|
|
227 |
M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize: %d - end", listSz);
|
|
228 |
return listSz;
|
|
229 |
}
|
|
230 |
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem
|
|
233 |
// -----------------------------------------------------------------------------
|
|
234 |
/**
|
|
235 |
* Calls MM2GSVGProxy::GetExternalListItemL method.
|
|
236 |
* @since Series S60 3.0
|
|
237 |
* @param aProxy Proxy instance.
|
|
238 |
* @param aDocumentHandle Document pointer.
|
|
239 |
* @param aIndex Index.
|
|
240 |
* @param aStrBuf Returns a string
|
|
241 |
* @throws Exception if not ok
|
|
242 |
* JNI method
|
|
243 |
*/
|
|
244 |
JNIEXPORT void JNICALL
|
|
245 |
Java_com_nokia_microedition_m2g_M2GSVGImage__1initViewport(
|
|
246 |
JNIEnv* aJni,
|
|
247 |
jclass,
|
|
248 |
jint aSvgProxyHandle,
|
|
249 |
jint aDocumentHandle)
|
|
250 |
{
|
|
251 |
M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport - begin");
|
87
|
252 |
|
|
253 |
TInt err = KM2GNotOk;
|
|
254 |
|
|
255 |
if (aSvgProxyHandle)
|
|
256 |
{
|
|
257 |
MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
|
|
258 |
TRAP(err, aProxy->InitViewportL(
|
|
259 |
STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle)););
|
|
260 |
}
|
|
261 |
M2GGeneral::CheckErrorCode(aJni, err);
|
|
262 |
|
|
263 |
M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport: %d - end", err);
|
80
|
264 |
|
|
265 |
}
|
|
266 |
|
|
267 |
M2G_NS_END
|