|
1 /******************************************************************************* |
|
2 * Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - initial implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 #include <QApplication> |
|
13 #include <QAction> |
|
14 #include <QActionGroup> |
|
15 #include <QEventLoop> |
|
16 #include <QMainWindow> |
|
17 #include <QString> |
|
18 #include <QVariant> |
|
19 #include <QWidget> |
|
20 #include <QDesktopWidget> |
|
21 #include <QPushButton> |
|
22 #include <QRadioButton> |
|
23 #include <QToolButton> |
|
24 #include <QCheckBox> |
|
25 #include <QLabel> |
|
26 #include <QPalette> |
|
27 #include <QColor> |
|
28 #include <QPixmap> |
|
29 #include <QAbstractEventDispatcher> |
|
30 #include <QThread> |
|
31 #include <QVector> |
|
32 #include <QTimer> |
|
33 #include <QMenu> |
|
34 #include <QMenuBar> |
|
35 #include <QFrame> |
|
36 #include <QScrollArea> |
|
37 #include <QScrollBar> |
|
38 #include <QListView> |
|
39 #include <QAbstractItemView> |
|
40 #include <QLineEdit> |
|
41 #include <QTextEdit> |
|
42 #include <QTextCursor> |
|
43 #include <QTextBlock> |
|
44 #include <QTextLayout> |
|
45 #include <QTextLine> |
|
46 #include <QTextOption> |
|
47 #include <QClipboard> |
|
48 #include <QScrollBar> |
|
49 #include <QFontMetrics> |
|
50 #include <QSlider> |
|
51 #include <QProgressBar> |
|
52 #include <QComboBox> |
|
53 #include <QColorDialog> |
|
54 #include <QKeyEvent> |
|
55 #include <QMouseEvent> |
|
56 #include <QTableWidget> |
|
57 #include <QHeaderView> |
|
58 #include <QFontDatabase> |
|
59 #include <QListWidget> |
|
60 #include <QMessageBox> |
|
61 #include <QInputDialog> |
|
62 #include <QDateTimeEdit> |
|
63 #include <QVBoxLayout> |
|
64 #include <QSortFilterProxyModel> |
|
65 #include <new> |
|
66 #include <QDesktopServices> |
|
67 #include <QUrl> |
|
68 #include <QTreeWidget> |
|
69 #include <QTabWidget> |
|
70 #include <QStackedWidget> |
|
71 #include <QUrl> |
|
72 #include <QCalendarWidget> |
|
73 #include <QProgressDialog> |
|
74 #include <QFileDialog> |
|
75 #include <QDialogButtonBox> |
|
76 #include <QFontDialog> |
|
77 #include <QLocale> |
|
78 #include <QInputContextFactory> |
|
79 #include <QChar> |
|
80 |
|
81 #ifndef QT_NO_WEBKIT |
|
82 #include <QWebView> |
|
83 #include <QWebFrame> |
|
84 #include <QWebHistory> |
|
85 #endif |
|
86 |
|
87 #ifdef __SYMBIAN32__ |
|
88 #include <xqservicerequest.h> |
|
89 #include <cntservicescontact.h> |
|
90 #endif |
|
91 |
|
92 #include <org_eclipse_swt_internal_qt_OS.h> |
|
93 #include "eventcallback.h" |
|
94 #include "slotcallback.h" |
|
95 #include "swtlog.h" |
|
96 #include "jniutils.h" |
|
97 #include "swtfontcache.h" |
|
98 #include "swt.h" |
|
99 #include "listdatamodel.h" |
|
100 #include "qcaptionedwidget.h" |
|
101 #include "qswttimeedit.h" |
|
102 #include "qtasktipbar.h" |
|
103 #include "swtapplication.h" |
|
104 #include "qswttabwidget.h" |
|
105 #include "autorelease.h" |
|
106 |
|
107 #ifdef __SYMBIAN32__ |
|
108 #include "swts60.h" |
|
109 #include "swtmobiledevice.h" |
|
110 #endif |
|
111 |
|
112 using namespace Java::eSWT; |
|
113 |
|
114 #define OS_NATIVE(func) Java_org_eclipse_swt_internal_qt_OS_##func |
|
115 |
|
116 #define POINTER_TO_HANDLE(pointer) reinterpret_cast<jint>(static_cast<QObject*>(pointer)) |
|
117 #define HANDLE_TO_POINTER(type, variable, handle) type variable = qobject_cast<type>(static_cast<type>(reinterpret_cast<QObject*>( handle ))) |
|
118 |
|
119 #define QCOLOR_TO_HANDLE(pointer) reinterpret_cast<jint>(static_cast<QColor*>(pointer)) |
|
120 #define HANDLE_TO_QCOLOR(variable, handle) QColor* variable = static_cast<QColor*>(reinterpret_cast<QColor*>( handle )) |
|
121 |
|
122 #define QTABLEWIDGETITEM_TO_HANDLE(pointer) reinterpret_cast<jint>(static_cast<QTableWidgetItem*>(pointer)) |
|
123 #define HANDLE_TO_QTABLEWIDGETITEM(variable, handle) QTableWidgetItem* variable = static_cast<QTableWidgetItem*>(reinterpret_cast<QTableWidgetItem*>( handle )) |
|
124 #define QTREEWIDGETITEM_TO_HANDLE(pointer) reinterpret_cast<jint>(static_cast<QTreeWidgetItem*>(pointer)) |
|
125 #define HANDLE_TO_QTREEWIDGETITEM(variable, handle) QTreeWidgetItem* variable = static_cast<QTreeWidgetItem*>(reinterpret_cast<QTreeWidgetItem*>( handle )) |
|
126 |
|
127 #define SWT_TRY try |
|
128 #define SWT_CATCH \ |
|
129 catch(std::bad_alloc const&)\ |
|
130 {\ |
|
131 swtApp->jniUtils().Throw( aJniEnv, ESwtErrorNoHandles );\ |
|
132 }\ |
|
133 catch(std::exception const&)\ |
|
134 {\ |
|
135 swtApp->jniUtils().Throw( aJniEnv, ESwtErrorUnspecified );\ |
|
136 } |
|
137 #define SWT_CATCH_1(err) \ |
|
138 catch(std::exception const&)\ |
|
139 {\ |
|
140 swtApp->jniUtils().Throw( aJniEnv, err );\ |
|
141 } |
|
142 |
|
143 #ifdef Q_WS_X11 |
|
144 void extern qt_x11_wait_for_window_manager(QWidget* widget); |
|
145 #endif |
|
146 |
|
147 const uint KParagraphSeparator = 8233; |
|
148 const int KTimedMessageBoxTimeout = 3000; |
|
149 |
|
150 // Following lines duplicate 3 hard-coded values from QLineEdit. |
|
151 // They are needed for computing client area size. |
|
152 // But there is no way to access them directly |
|
153 const int QLineEdit_minimumLineSpacing = 14; |
|
154 const int QLineEdit_verticalMargin = 1; |
|
155 const int QLineEdit_horizontalMargin = 2; |
|
156 |
|
157 #ifdef __cplusplus |
|
158 extern "C" { |
|
159 #endif |
|
160 |
|
161 // |
|
162 // QApplication |
|
163 // |
|
164 |
|
165 JNIEXPORT jint JNICALL OS_NATIVE(QApplication_1swt_1new) |
|
166 (JNIEnv* aJniEnv, jclass , jint aJniUtils) |
|
167 { |
|
168 SwtApplication* app = NULL; |
|
169 HANDLE_TO_POINTER( JniUtils*, jniUtils, aJniUtils); |
|
170 |
|
171 class Args : public QObject |
|
172 { |
|
173 public: |
|
174 Args() : argc(0) {} |
|
175 virtual ~Args() {} |
|
176 char* argv[1]; |
|
177 int argc; |
|
178 }; |
|
179 Args* args = NULL; |
|
180 |
|
181 try |
|
182 { |
|
183 SWT_LOG_JNI_CALL(); |
|
184 SWT_LOG_DATA_1("Compiled against Qt version %s", QT_VERSION_STR); |
|
185 |
|
186 args = new Args(); |
|
187 QCoreApplication* oldApp = NULL; |
|
188 oldApp = QCoreApplication::instance(); |
|
189 if( !oldApp ) |
|
190 { |
|
191 app = new SwtApplication( args->argc, args->argv, jniUtils ); |
|
192 } |
|
193 else |
|
194 { |
|
195 // QApplication already exists |
|
196 jniUtils->Throw( aJniEnv, ESwtErrorUnspecified ); |
|
197 } |
|
198 args->setParent( app ); |
|
199 } |
|
200 catch(...) |
|
201 { |
|
202 delete args; |
|
203 delete app; |
|
204 jniUtils->Throw( aJniEnv, ESwtErrorNoHandles ); |
|
205 } |
|
206 return POINTER_TO_HANDLE( app ); |
|
207 } |
|
208 |
|
209 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1swt_1palette_1new__ ) |
|
210 (JNIEnv* aJniEnv, jclass) |
|
211 { |
|
212 QPalette* palette( NULL ); |
|
213 SWT_TRY |
|
214 { |
|
215 SWT_LOG_JNI_CALL(); |
|
216 palette = new QPalette( QApplication::palette () ); |
|
217 } |
|
218 SWT_CATCH |
|
219 return reinterpret_cast< jint >( palette ); |
|
220 } |
|
221 |
|
222 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1swt_1palette_1new__I ) |
|
223 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
224 { |
|
225 QPalette* palette( NULL ); |
|
226 SWT_TRY |
|
227 { |
|
228 SWT_LOG_JNI_CALL(); |
|
229 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
230 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
231 palette = new QPalette( QApplication::palette(widget) ); |
|
232 } |
|
233 SWT_CATCH |
|
234 return reinterpret_cast< jint >( palette ); |
|
235 } |
|
236 |
|
237 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1focusWidget ) |
|
238 (JNIEnv* aJniEnv, jclass) |
|
239 { |
|
240 jint focusHandle = 0; |
|
241 SWT_TRY |
|
242 { |
|
243 SWT_LOG_JNI_CALL(); |
|
244 |
|
245 QApplication* app = static_cast<QApplication*>( QCoreApplication::instance() ); |
|
246 if( app ) |
|
247 { |
|
248 QWidget* focusWidget = app->focusWidget(); |
|
249 focusHandle = POINTER_TO_HANDLE( focusWidget ); |
|
250 } |
|
251 } |
|
252 SWT_CATCH |
|
253 return focusHandle; |
|
254 } |
|
255 |
|
256 JNIEXPORT void JNICALL OS_NATIVE( QApplication_1setQuitOnLastWindowClosed ) |
|
257 (JNIEnv* aJniEnv , jclass, jboolean aQuit) |
|
258 { |
|
259 SWT_TRY |
|
260 { |
|
261 SWT_LOG_JNI_CALL(); |
|
262 static_cast<QApplication*>(qApp)->setQuitOnLastWindowClosed( aQuit == JNI_TRUE ? true : false ); |
|
263 } |
|
264 SWT_CATCH |
|
265 } |
|
266 |
|
267 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1desktop ) |
|
268 (JNIEnv* aJniEnv , jclass) |
|
269 { |
|
270 QDesktopWidget* res = NULL; |
|
271 SWT_TRY |
|
272 { |
|
273 SWT_LOG_JNI_CALL(); |
|
274 res = qApp->desktop(); |
|
275 } |
|
276 SWT_CATCH |
|
277 return POINTER_TO_HANDLE( res ); |
|
278 } |
|
279 |
|
280 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1swt_1desktopPaintDevice ) |
|
281 (JNIEnv* aJniEnv , jclass) |
|
282 { |
|
283 QPaintDevice* res = NULL; |
|
284 SWT_TRY |
|
285 { |
|
286 SWT_LOG_JNI_CALL(); |
|
287 res = static_cast<QPaintDevice*>( QApplication::desktop() ); |
|
288 } |
|
289 SWT_CATCH |
|
290 return reinterpret_cast<jint>( res ); |
|
291 } |
|
292 |
|
293 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1activeWindow ) |
|
294 (JNIEnv* aJniEnv , jclass) |
|
295 { |
|
296 QWidget* active = NULL; |
|
297 SWT_TRY |
|
298 { |
|
299 SWT_LOG_JNI_CALL(); |
|
300 active = QApplication::activeWindow(); |
|
301 } |
|
302 SWT_CATCH |
|
303 return POINTER_TO_HANDLE( active ); |
|
304 } |
|
305 |
|
306 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1swt_1font_1new__ ) |
|
307 (JNIEnv* aJniEnv , jclass) |
|
308 { |
|
309 QFont* font = NULL; |
|
310 SWT_TRY |
|
311 { |
|
312 SWT_LOG_JNI_CALL(); |
|
313 |
|
314 // Implicitly shared, shallow copy |
|
315 font = new QFont( QApplication::font() ); |
|
316 } |
|
317 SWT_CATCH |
|
318 return reinterpret_cast< jint >( font ); |
|
319 } |
|
320 |
|
321 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1swt_1font_1new__I ) |
|
322 (JNIEnv* aJniEnv, jclass, jint aWidgetHandle) |
|
323 { |
|
324 QFont* font = NULL; |
|
325 SWT_TRY |
|
326 { |
|
327 SWT_LOG_JNI_CALL(); |
|
328 HANDLE_TO_POINTER( QWidget*, widget, aWidgetHandle ); |
|
329 |
|
330 // Implicitly shared, shallow copy |
|
331 font = new QFont( QApplication::font( widget ) ); |
|
332 } |
|
333 SWT_CATCH |
|
334 return reinterpret_cast< jint >( font ); |
|
335 } |
|
336 |
|
337 JNIEXPORT void JNICALL OS_NATIVE( QApplication_1beep ) |
|
338 (JNIEnv* aJniEnv , jclass) |
|
339 { |
|
340 SWT_TRY |
|
341 { |
|
342 SWT_LOG_JNI_CALL(); |
|
343 static_cast<QApplication*>(qApp)->beep(); |
|
344 } |
|
345 SWT_CATCH |
|
346 } |
|
347 |
|
348 JNIEXPORT void JNICALL OS_NATIVE( QApplication_1syncX ) |
|
349 (JNIEnv* aJniEnv , jclass) |
|
350 { |
|
351 SWT_TRY |
|
352 { |
|
353 SWT_LOG_JNI_CALL(); |
|
354 static_cast<QApplication*>(qApp)->syncX(); |
|
355 } |
|
356 SWT_CATCH |
|
357 } |
|
358 |
|
359 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1doubleClickInterval ) |
|
360 ( JNIEnv* aJniEnv , jclass ) |
|
361 { |
|
362 jint res = 0; |
|
363 SWT_TRY |
|
364 { |
|
365 SWT_LOG_JNI_CALL(); |
|
366 res = static_cast<jint>( qApp->doubleClickInterval() ); |
|
367 } |
|
368 SWT_CATCH |
|
369 return res; |
|
370 } |
|
371 |
|
372 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1style ) |
|
373 (JNIEnv* aJniEnv , jclass) |
|
374 { |
|
375 QStyle* style = NULL; |
|
376 SWT_TRY |
|
377 { |
|
378 SWT_LOG_JNI_CALL(); |
|
379 |
|
380 QApplication* app = static_cast<QApplication*>( QCoreApplication::instance() ); |
|
381 if( app ) |
|
382 { |
|
383 style = app->style(); |
|
384 } |
|
385 } |
|
386 SWT_CATCH |
|
387 return POINTER_TO_HANDLE( style ); |
|
388 } |
|
389 |
|
390 JNIEXPORT jint JNICALL OS_NATIVE( QApplication_1layoutDirection ) |
|
391 (JNIEnv* aJniEnv, jclass) |
|
392 { |
|
393 Qt::LayoutDirection direction = Qt::LeftToRight; |
|
394 SWT_TRY |
|
395 { |
|
396 SWT_LOG_JNI_CALL(); |
|
397 direction = qApp->layoutDirection(); |
|
398 } |
|
399 SWT_CATCH |
|
400 return static_cast<int>( direction ); |
|
401 } |
|
402 |
|
403 JNIEXPORT void JNICALL OS_NATIVE( QApplication_1setLayoutDirection ) |
|
404 (JNIEnv* aJniEnv, jclass, jint aDirection) |
|
405 { |
|
406 SWT_TRY |
|
407 { |
|
408 SWT_LOG_JNI_CALL(); |
|
409 SWT_LOG_DATA_1("direction=%d", aDirection); |
|
410 qApp->setLayoutDirection(static_cast<Qt::LayoutDirection>(aDirection)); |
|
411 } |
|
412 SWT_CATCH |
|
413 } |
|
414 |
|
415 JNIEXPORT void JNICALL OS_NATIVE( QApplication_1setDoubleClickInterval ) |
|
416 (JNIEnv * aJniEnv, jclass, jint aInterval) |
|
417 { |
|
418 SWT_TRY |
|
419 { |
|
420 SWT_LOG_JNI_CALL(); |
|
421 SWT_LOG_DATA_1("interval=%d", aInterval); |
|
422 qApp->setDoubleClickInterval( aInterval ); |
|
423 } |
|
424 SWT_CATCH |
|
425 } |
|
426 |
|
427 JNIEXPORT jboolean JNICALL OS_NATIVE( QApplication_1autoSipEnabled) |
|
428 (JNIEnv* aJniEnv, jclass) |
|
429 { |
|
430 jboolean enabled = JNI_FALSE; |
|
431 #ifndef Q_WS_X11 |
|
432 SWT_TRY |
|
433 { |
|
434 SWT_LOG_JNI_CALL(); |
|
435 enabled = qApp->autoSipEnabled(); |
|
436 } |
|
437 SWT_CATCH |
|
438 #endif |
|
439 return ( enabled ? JNI_TRUE : JNI_FALSE ); |
|
440 } |
|
441 |
|
442 JNIEXPORT void JNICALL OS_NATIVE(QApplication_1setStyleSheet) |
|
443 (JNIEnv* aJniEnv, jclass, jstring aStyle) |
|
444 { |
|
445 SWT_TRY |
|
446 { |
|
447 SWT_LOG_JNI_CALL(); |
|
448 qApp->setStyleSheet( swtApp->jniUtils().JavaStringToQString( aJniEnv, aStyle ) ); |
|
449 } |
|
450 SWT_CATCH |
|
451 } |
|
452 |
|
453 JNIEXPORT void JNICALL OS_NATIVE(QApplication_1closeAllWindows) |
|
454 (JNIEnv* aJniEnv, jclass) |
|
455 { |
|
456 SWT_TRY |
|
457 { |
|
458 SWT_LOG_JNI_CALL(); |
|
459 qApp->closeAllWindows(); |
|
460 } |
|
461 SWT_CATCH |
|
462 } |
|
463 |
|
464 // |
|
465 // QCoreApplication |
|
466 // |
|
467 |
|
468 JNIEXPORT jint JNICALL OS_NATIVE(QCoreApplication_1instance) |
|
469 ( JNIEnv* aJniEnv , jclass ) |
|
470 { |
|
471 QApplication* app = NULL; |
|
472 SWT_TRY |
|
473 { |
|
474 SWT_LOG_JNI_CALL(); |
|
475 app = static_cast<QApplication*>(QCoreApplication::instance()); |
|
476 } |
|
477 SWT_CATCH |
|
478 return POINTER_TO_HANDLE(app); |
|
479 } |
|
480 |
|
481 JNIEXPORT void JNICALL OS_NATIVE( QCoreApplication_1setApplicationName) |
|
482 ( JNIEnv* aJniEnv, jclass, jint aHandle, jstring aName ) |
|
483 { |
|
484 SWT_TRY |
|
485 { |
|
486 SWT_LOG_JNI_CALL(); |
|
487 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
488 |
|
489 HANDLE_TO_POINTER( QApplication*, app, aHandle ); |
|
490 app->setApplicationName( swtApp->jniUtils().JavaStringToQString( aJniEnv, aName ) ); |
|
491 } |
|
492 SWT_CATCH |
|
493 } |
|
494 |
|
495 JNIEXPORT void JNICALL OS_NATIVE( QCoreApplication_1processEvents ) |
|
496 ( JNIEnv* aJniEnv , jclass, jint handle, jint flags ) |
|
497 { |
|
498 SWT_TRY |
|
499 { |
|
500 SWT_LOG_JNI_CALL(); |
|
501 SWT_LOG_DATA_2("handle=%x flags=%x", handle, flags); |
|
502 |
|
503 HANDLE_TO_POINTER( QCoreApplication*, app, handle ); |
|
504 app->processEvents( static_cast<QEventLoop::ProcessEventsFlags>( flags ) ); |
|
505 } |
|
506 SWT_CATCH |
|
507 } |
|
508 |
|
509 JNIEXPORT void JNICALL OS_NATIVE(QCoreApplication_1sendPostedEvents__I) |
|
510 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
511 { |
|
512 SWT_TRY |
|
513 { |
|
514 SWT_LOG_JNI_CALL(); |
|
515 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
516 |
|
517 HANDLE_TO_POINTER( QCoreApplication*, app, aHandle ); |
|
518 app->sendPostedEvents(); |
|
519 } |
|
520 SWT_CATCH |
|
521 } |
|
522 |
|
523 JNIEXPORT void JNICALL OS_NATIVE(QCoreApplication_1sendPostedEvents__III) |
|
524 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aReceiver, jint aEventType ) |
|
525 { |
|
526 SWT_TRY |
|
527 { |
|
528 SWT_LOG_JNI_CALL(); |
|
529 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
530 |
|
531 HANDLE_TO_POINTER( QCoreApplication*, app, aHandle ); |
|
532 HANDLE_TO_POINTER( QObject*, receiver, aReceiver ); |
|
533 app->sendPostedEvents( receiver, aEventType ); |
|
534 } |
|
535 SWT_CATCH |
|
536 } |
|
537 |
|
538 JNIEXPORT jboolean JNICALL OS_NATIVE(QCoreApplication_1hasPendingEvents) |
|
539 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
540 { |
|
541 jboolean hasEvents = JNI_FALSE; |
|
542 SWT_TRY |
|
543 { |
|
544 SWT_LOG_JNI_CALL(); |
|
545 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
546 |
|
547 HANDLE_TO_POINTER( QCoreApplication*, app, aHandle ); |
|
548 hasEvents = static_cast<int>(app->hasPendingEvents()); |
|
549 } |
|
550 SWT_CATCH |
|
551 return hasEvents; |
|
552 } |
|
553 |
|
554 JNIEXPORT void JNICALL OS_NATIVE( QCoreApplication_1postEvent ) |
|
555 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aReceiver, jint aEventHandle) |
|
556 { |
|
557 SWT_TRY |
|
558 { |
|
559 SWT_LOG_JNI_CALL(); |
|
560 SWT_LOG_DATA_3("handle=%x receiver=%x event=%x", aHandle, aReceiver, aEventHandle); |
|
561 |
|
562 HANDLE_TO_POINTER( QCoreApplication*, app, aHandle ); |
|
563 HANDLE_TO_POINTER( QObject*, receiver, aReceiver ); |
|
564 |
|
565 // Not a QObject |
|
566 QEvent* event = reinterpret_cast<QEvent*>( aEventHandle ); |
|
567 |
|
568 // Takes ownership of the event |
|
569 app->postEvent( receiver, event ); |
|
570 } |
|
571 SWT_CATCH |
|
572 } |
|
573 |
|
574 JNIEXPORT void JNICALL OS_NATIVE( QCoreApplication_1sendEvent ) |
|
575 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aReceiver, jint aEventHandle) |
|
576 { |
|
577 SWT_TRY |
|
578 { |
|
579 SWT_LOG_JNI_CALL(); |
|
580 SWT_LOG_DATA_3("handle=%x receiver=%x event=%x", aHandle, aReceiver, aEventHandle); |
|
581 |
|
582 HANDLE_TO_POINTER( QCoreApplication*, app, aHandle ); |
|
583 HANDLE_TO_POINTER( QObject*, receiver, aReceiver ); |
|
584 |
|
585 // Not a QObject |
|
586 QEvent* event = reinterpret_cast<QEvent*>( aEventHandle ); |
|
587 |
|
588 // Does not take ownership of the event |
|
589 app->sendEvent( receiver, event ); |
|
590 delete event; |
|
591 } |
|
592 SWT_CATCH |
|
593 } |
|
594 |
|
595 // |
|
596 // QAbstractEventDispatcher |
|
597 // |
|
598 |
|
599 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractEventDispatcher_1instance ) |
|
600 ( JNIEnv* aJniEnv , jclass, jint aThreadHandle ) |
|
601 { |
|
602 QAbstractEventDispatcher* dispatcher = NULL; |
|
603 SWT_TRY |
|
604 { |
|
605 SWT_LOG_JNI_CALL(); |
|
606 SWT_LOG_DATA_1( "handle=%x", aThreadHandle ); |
|
607 HANDLE_TO_POINTER( QThread*, thread, aThreadHandle ); |
|
608 dispatcher = QAbstractEventDispatcher::instance( thread ); |
|
609 } |
|
610 SWT_CATCH |
|
611 return POINTER_TO_HANDLE( dispatcher ); |
|
612 } |
|
613 |
|
614 JNIEXPORT void JNICALL OS_NATIVE( QAbstractEventDispatcher_1wakeup) |
|
615 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
616 { |
|
617 SWT_TRY |
|
618 { |
|
619 SWT_LOG_JNI_CALL(); |
|
620 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
621 HANDLE_TO_POINTER( QAbstractEventDispatcher*, dispatcher, aHandle ); |
|
622 dispatcher->wakeUp(); |
|
623 } |
|
624 SWT_CATCH |
|
625 } |
|
626 |
|
627 JNIEXPORT void JNICALL OS_NATIVE( QAbstractEventDispatcher_1interrupt ) |
|
628 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
629 { |
|
630 SWT_TRY |
|
631 { |
|
632 SWT_LOG_JNI_CALL(); |
|
633 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
634 HANDLE_TO_POINTER( QAbstractEventDispatcher*, dispatcher, aHandle ); |
|
635 dispatcher->interrupt(); |
|
636 } |
|
637 SWT_CATCH |
|
638 } |
|
639 |
|
640 // |
|
641 // QMainWindow |
|
642 // |
|
643 |
|
644 JNIEXPORT jint JNICALL OS_NATIVE(QMainWindow_1new) |
|
645 ( JNIEnv* aJniEnv , jclass, jint aParent, jint aFlags ) |
|
646 { |
|
647 QMainWindow* mainWindow = NULL; |
|
648 SWT_TRY |
|
649 { |
|
650 SWT_LOG_JNI_CALL(); |
|
651 SWT_LOG_DATA_2("parent=%x flags=%x", aParent, aFlags); |
|
652 |
|
653 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
654 mainWindow = new QMainWindow( parent, static_cast<Qt::WindowFlags>(aFlags) ); |
|
655 } |
|
656 SWT_CATCH |
|
657 return POINTER_TO_HANDLE( mainWindow ); |
|
658 } |
|
659 |
|
660 JNIEXPORT void JNICALL OS_NATIVE( QMainWindow_1setMenuBar ) |
|
661 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMenuBarHandle ) |
|
662 { |
|
663 SWT_TRY |
|
664 { |
|
665 SWT_LOG_JNI_CALL(); |
|
666 SWT_LOG_DATA_2("handle=%x menubarHandle=%x", aHandle, aMenuBarHandle ); |
|
667 HANDLE_TO_POINTER( QMainWindow*, mainWindow, aHandle ); |
|
668 HANDLE_TO_POINTER( QMenuBar*, menuBar, aMenuBarHandle ); |
|
669 mainWindow->setMenuBar( menuBar ); |
|
670 } |
|
671 SWT_CATCH |
|
672 |
|
673 } |
|
674 |
|
675 JNIEXPORT void JNICALL OS_NATIVE( QMainWindow_1setCentralWidget ) |
|
676 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidget) |
|
677 { |
|
678 SWT_TRY |
|
679 { |
|
680 SWT_LOG_JNI_CALL(); |
|
681 SWT_LOG_DATA_2( "handle=%x widget=%x", aHandle, aWidget ); |
|
682 HANDLE_TO_POINTER( QMainWindow*, mainWindow, aHandle ); |
|
683 HANDLE_TO_POINTER( QWidget*, widget, aWidget ); |
|
684 mainWindow->setCentralWidget( widget ); |
|
685 } |
|
686 SWT_CATCH |
|
687 } |
|
688 |
|
689 // |
|
690 // QPaintDevice |
|
691 // |
|
692 |
|
693 JNIEXPORT jint JNICALL OS_NATIVE( QPaintDevice_1depth ) |
|
694 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
695 { |
|
696 jint res = 0; |
|
697 SWT_TRY |
|
698 { |
|
699 SWT_LOG_JNI_CALL(); |
|
700 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
701 // Not a QObject |
|
702 QPaintDevice* dev = reinterpret_cast<QPaintDevice*>( static_cast<int>( aHandle ) ); |
|
703 res = dev->depth(); |
|
704 } |
|
705 SWT_CATCH |
|
706 return res; |
|
707 } |
|
708 |
|
709 JNIEXPORT jint JNICALL OS_NATIVE( QPaintDevice_1physicalDpiX ) |
|
710 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
711 { |
|
712 jint res = 0; |
|
713 SWT_TRY |
|
714 { |
|
715 SWT_LOG_JNI_CALL(); |
|
716 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
717 // Not a QObject |
|
718 QPaintDevice* dev = reinterpret_cast<QPaintDevice*>( static_cast<int>( aHandle ) ); |
|
719 res = static_cast<jint>( dev->physicalDpiX() ); |
|
720 } |
|
721 SWT_CATCH |
|
722 return res; |
|
723 } |
|
724 |
|
725 JNIEXPORT jint JNICALL OS_NATIVE( QPaintDevice_1physicalDpiY ) |
|
726 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
727 { |
|
728 jint res = 0; |
|
729 SWT_TRY |
|
730 { |
|
731 SWT_LOG_JNI_CALL(); |
|
732 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
733 // Not a QObject |
|
734 QPaintDevice* dev = reinterpret_cast<QPaintDevice*>( static_cast<int>( aHandle ) ); |
|
735 res = static_cast<jint>( dev->physicalDpiY() ); |
|
736 } |
|
737 SWT_CATCH |
|
738 return res; |
|
739 } |
|
740 |
|
741 JNIEXPORT jint JNICALL OS_NATIVE( QPaintDevice_1width ) |
|
742 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
743 { |
|
744 jint res = 0; |
|
745 SWT_TRY |
|
746 { |
|
747 SWT_LOG_JNI_CALL(); |
|
748 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
749 // Not a QObject |
|
750 QPaintDevice* dev = reinterpret_cast<QPaintDevice*>( static_cast<int>( aHandle ) ); |
|
751 res = static_cast<jint>( dev->width() ); |
|
752 } |
|
753 SWT_CATCH |
|
754 return res; |
|
755 } |
|
756 |
|
757 JNIEXPORT jint JNICALL OS_NATIVE( QPaintDevice_1height ) |
|
758 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
759 { |
|
760 jint res = 0; |
|
761 SWT_TRY |
|
762 { |
|
763 SWT_LOG_JNI_CALL(); |
|
764 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
765 // Not a QObject |
|
766 QPaintDevice* dev = reinterpret_cast<QPaintDevice*>( static_cast<int>( aHandle ) ); |
|
767 res = static_cast<jint>( dev->height() ); |
|
768 } |
|
769 SWT_CATCH |
|
770 return res; |
|
771 } |
|
772 |
|
773 JNIEXPORT jboolean JNICALL OS_NATIVE( QPaintDevice_1paintingActive ) |
|
774 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
775 { |
|
776 jboolean res = JNI_FALSE; |
|
777 SWT_TRY |
|
778 { |
|
779 SWT_LOG_JNI_CALL(); |
|
780 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
781 // Not a QObject |
|
782 QPaintDevice* dev = reinterpret_cast<QPaintDevice*>( static_cast<int>( aHandle ) ); |
|
783 res = (dev->paintingActive() ? JNI_TRUE : JNI_FALSE); |
|
784 } |
|
785 SWT_CATCH |
|
786 return res; |
|
787 } |
|
788 |
|
789 // |
|
790 // QWidget |
|
791 // |
|
792 |
|
793 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1new ) |
|
794 (JNIEnv* aJniEnv , jclass, jint aParent, jint aFlags) |
|
795 { |
|
796 QWidget* widget = NULL; |
|
797 SWT_TRY |
|
798 { |
|
799 SWT_LOG_JNI_CALL(); |
|
800 SWT_LOG_DATA_2("parent=%x flags=%x", aParent, aFlags); |
|
801 |
|
802 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
803 widget = new QWidget( parent, static_cast<Qt::WindowFlags>(aFlags) ); |
|
804 } |
|
805 SWT_CATCH |
|
806 return POINTER_TO_HANDLE( widget ); |
|
807 } |
|
808 |
|
809 JNIEXPORT void JNICALL OS_NATIVE(QWidget_1setVisible) |
|
810 ( JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aVisible ) |
|
811 { |
|
812 SWT_TRY |
|
813 { |
|
814 SWT_LOG_JNI_CALL(); |
|
815 SWT_LOG_DATA_2("handle=%x visible=%d", aHandle, aVisible); |
|
816 |
|
817 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
818 widget->setVisible( aVisible == JNI_TRUE ? true : false ); |
|
819 } |
|
820 SWT_CATCH |
|
821 } |
|
822 |
|
823 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isVisible ) |
|
824 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
825 { |
|
826 bool visible = false; |
|
827 SWT_TRY |
|
828 { |
|
829 SWT_LOG_JNI_CALL(); |
|
830 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
831 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
832 visible = widget->isVisible(); |
|
833 } |
|
834 SWT_CATCH |
|
835 return ( visible ? JNI_TRUE : JNI_FALSE ); |
|
836 } |
|
837 |
|
838 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isVisibleTo ) |
|
839 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aParentHandle) |
|
840 { |
|
841 bool visible = false; |
|
842 SWT_TRY |
|
843 { |
|
844 SWT_LOG_JNI_CALL(); |
|
845 SWT_LOG_DATA_2("handle=%x parentHandle=%x", aHandle, aParentHandle); |
|
846 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
847 HANDLE_TO_POINTER( QWidget*, parent, aParentHandle ); |
|
848 visible = widget->isVisibleTo(parent); |
|
849 } |
|
850 SWT_CATCH |
|
851 return ( visible ? JNI_TRUE : JNI_FALSE ); |
|
852 } |
|
853 |
|
854 JNIEXPORT void JNICALL OS_NATIVE(QWidget_1setParent) |
|
855 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aParent ) |
|
856 { |
|
857 SWT_TRY |
|
858 { |
|
859 SWT_LOG_JNI_CALL(); |
|
860 SWT_LOG_DATA_2("handle=%x parent=%x", aHandle, aParent); |
|
861 |
|
862 HANDLE_TO_POINTER( QWidget*, child, aHandle ); |
|
863 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
864 child->setParent( parent ); |
|
865 } |
|
866 SWT_CATCH |
|
867 } |
|
868 |
|
869 JNIEXPORT void JNICALL OS_NATIVE(QWidget_1resize) |
|
870 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight ) |
|
871 { |
|
872 SWT_TRY |
|
873 { |
|
874 SWT_LOG_JNI_CALL(); |
|
875 SWT_LOG_DATA_3("handle=%x width=%d height=%d", aHandle, aWidth, aHeight); |
|
876 |
|
877 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
878 widget->resize( aWidth, aHeight ); |
|
879 } |
|
880 SWT_CATCH |
|
881 } |
|
882 |
|
883 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1update__IIIII ) |
|
884 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
885 { |
|
886 SWT_TRY |
|
887 { |
|
888 SWT_LOG_JNI_CALL(); |
|
889 SWT_LOG_DATA_5("handle=%x x=%d y=%d width=%d height=%d", aHandle, aX, aY, aWidth, aHeight); |
|
890 |
|
891 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
892 widget->update( aX, aY, aWidth, aHeight ); |
|
893 } |
|
894 SWT_CATCH |
|
895 } |
|
896 |
|
897 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1update__I ) |
|
898 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
899 { |
|
900 SWT_TRY |
|
901 { |
|
902 SWT_LOG_JNI_CALL(); |
|
903 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
904 |
|
905 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
906 widget->update(); |
|
907 } |
|
908 SWT_CATCH |
|
909 } |
|
910 |
|
911 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1repaint ) |
|
912 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
913 { |
|
914 SWT_TRY |
|
915 { |
|
916 SWT_LOG_JNI_CALL(); |
|
917 SWT_LOG_DATA_5("handle=%x x=%d y=%d width=%d height=%d", aHandle, aX, aY, aWidth, aHeight); |
|
918 |
|
919 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
920 widget->repaint( aX, aY, aWidth, aHeight ); |
|
921 } |
|
922 SWT_CATCH |
|
923 } |
|
924 |
|
925 JNIEXPORT jobject JNICALL OS_NATIVE(QWidget_1rect) |
|
926 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
927 { |
|
928 jobject javaRect = NULL; |
|
929 SWT_TRY |
|
930 { |
|
931 SWT_LOG_JNI_CALL(); |
|
932 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
933 |
|
934 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
935 QRect rect = widget->rect(); |
|
936 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
937 } |
|
938 SWT_CATCH |
|
939 return javaRect; |
|
940 } |
|
941 |
|
942 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1sizeHint ) |
|
943 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
944 { |
|
945 jobject javaPoint = NULL; |
|
946 SWT_TRY |
|
947 { |
|
948 SWT_LOG_JNI_CALL(); |
|
949 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
950 |
|
951 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
952 |
|
953 QSize size = widget->sizeHint(); |
|
954 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
955 } |
|
956 SWT_CATCH |
|
957 return javaPoint; |
|
958 } |
|
959 |
|
960 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1maximumSize ) |
|
961 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
962 { |
|
963 jobject javaPoint = NULL; |
|
964 SWT_TRY |
|
965 { |
|
966 SWT_LOG_JNI_CALL(); |
|
967 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
968 |
|
969 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
970 |
|
971 QSize size = widget->maximumSize(); |
|
972 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
973 } |
|
974 SWT_CATCH |
|
975 return javaPoint; |
|
976 } |
|
977 |
|
978 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setMaximumSize ) |
|
979 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMaxWidth, jint aMaxHeight) |
|
980 { |
|
981 SWT_TRY |
|
982 { |
|
983 SWT_LOG_JNI_CALL(); |
|
984 SWT_LOG_DATA_3("handle=%x maxw=%d maxh=%d", aHandle, aMaxWidth, aMaxHeight); |
|
985 |
|
986 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
987 widget->setMaximumSize( aMaxWidth, aMaxHeight ); |
|
988 } |
|
989 SWT_CATCH |
|
990 } |
|
991 |
|
992 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setMinimumSize ) |
|
993 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMinWidth, jint aMinHeight) |
|
994 { |
|
995 SWT_TRY |
|
996 { |
|
997 SWT_LOG_JNI_CALL(); |
|
998 SWT_LOG_DATA_3("handle=%x minw=%d minh=%d", aHandle, aMinWidth, aMinHeight); |
|
999 |
|
1000 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1001 widget->setMinimumSize( aMinWidth, aMinHeight ); |
|
1002 } |
|
1003 SWT_CATCH |
|
1004 } |
|
1005 |
|
1006 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1minimumSize ) |
|
1007 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1008 { |
|
1009 jobject javaPoint = NULL; |
|
1010 SWT_TRY |
|
1011 { |
|
1012 SWT_LOG_JNI_CALL(); |
|
1013 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1014 |
|
1015 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1016 |
|
1017 QSize size = widget->minimumSize(); |
|
1018 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
1019 } |
|
1020 SWT_CATCH |
|
1021 return javaPoint; |
|
1022 } |
|
1023 |
|
1024 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1frameSize ) |
|
1025 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1026 { |
|
1027 jobject javaPoint = NULL; |
|
1028 SWT_TRY |
|
1029 { |
|
1030 SWT_LOG_JNI_CALL(); |
|
1031 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1032 |
|
1033 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1034 |
|
1035 QSize size = widget->frameSize(); |
|
1036 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
1037 } |
|
1038 SWT_CATCH |
|
1039 return javaPoint; |
|
1040 } |
|
1041 |
|
1042 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1geometry ) |
|
1043 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1044 { |
|
1045 jobject javaRect = NULL; |
|
1046 SWT_TRY |
|
1047 { |
|
1048 SWT_LOG_JNI_CALL(); |
|
1049 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1050 |
|
1051 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1052 QRect rect = widget->geometry(); |
|
1053 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
1054 } |
|
1055 SWT_CATCH |
|
1056 return javaRect; |
|
1057 } |
|
1058 |
|
1059 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1frameGeometry ) |
|
1060 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1061 { |
|
1062 jobject javaRect = NULL; |
|
1063 SWT_TRY |
|
1064 { |
|
1065 SWT_LOG_JNI_CALL(); |
|
1066 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1067 |
|
1068 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1069 QRect rect = widget->frameGeometry(); |
|
1070 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
1071 } |
|
1072 SWT_CATCH |
|
1073 return javaRect; |
|
1074 } |
|
1075 |
|
1076 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setGeometry ) |
|
1077 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
1078 { |
|
1079 SWT_TRY |
|
1080 { |
|
1081 SWT_LOG_JNI_CALL(); |
|
1082 SWT_LOG_DATA_5("handle=%x x=%d y=%d width=%d height=%d", aHandle, aX, aY, aWidth, aHeight); |
|
1083 |
|
1084 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1085 widget->setGeometry( aX, aY, aWidth, aHeight ); |
|
1086 } |
|
1087 SWT_CATCH |
|
1088 } |
|
1089 |
|
1090 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1move ) |
|
1091 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
1092 { |
|
1093 SWT_TRY |
|
1094 { |
|
1095 SWT_LOG_JNI_CALL(); |
|
1096 SWT_LOG_DATA_3("handle=%x x=%d y=%d", aHandle, aX, aY); |
|
1097 |
|
1098 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1099 widget->move( aX, aY ); |
|
1100 } |
|
1101 SWT_CATCH |
|
1102 } |
|
1103 |
|
1104 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1pos ) |
|
1105 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1106 { |
|
1107 jobject javaPoint = NULL; |
|
1108 SWT_TRY |
|
1109 { |
|
1110 SWT_LOG_JNI_CALL(); |
|
1111 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1112 |
|
1113 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1114 |
|
1115 QPoint pos = widget->pos(); |
|
1116 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, pos ); |
|
1117 } |
|
1118 SWT_CATCH |
|
1119 return javaPoint; |
|
1120 } |
|
1121 |
|
1122 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1size ) |
|
1123 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1124 { |
|
1125 jobject javaPoint = NULL; |
|
1126 SWT_TRY |
|
1127 { |
|
1128 SWT_LOG_JNI_CALL(); |
|
1129 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1130 |
|
1131 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1132 |
|
1133 QSize size = widget->size(); |
|
1134 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
1135 } |
|
1136 SWT_CATCH |
|
1137 return javaPoint; |
|
1138 } |
|
1139 |
|
1140 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setFocus ) |
|
1141 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFocusReason) |
|
1142 { |
|
1143 SWT_TRY |
|
1144 { |
|
1145 SWT_LOG_JNI_CALL(); |
|
1146 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1147 |
|
1148 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1149 widget->setFocus( static_cast<Qt::FocusReason>( aFocusReason ) ); |
|
1150 } |
|
1151 SWT_CATCH |
|
1152 } |
|
1153 |
|
1154 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1swt_1palette_1new ) |
|
1155 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1156 { |
|
1157 QPalette* palette( NULL ); |
|
1158 SWT_TRY |
|
1159 { |
|
1160 SWT_LOG_JNI_CALL(); |
|
1161 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1162 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1163 palette = new QPalette( widget->palette() ); |
|
1164 } |
|
1165 SWT_CATCH |
|
1166 return reinterpret_cast< jint >( palette ); |
|
1167 } |
|
1168 |
|
1169 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setPalette ) |
|
1170 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPaletteHandle ) |
|
1171 { |
|
1172 SWT_TRY |
|
1173 { |
|
1174 SWT_LOG_JNI_CALL(); |
|
1175 SWT_LOG_DATA_2("handle=%x paletteHandle=%x", aHandle, aPaletteHandle ); |
|
1176 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1177 QPalette* palette = reinterpret_cast< QPalette* >( aPaletteHandle ); |
|
1178 widget->setPalette( *palette ); |
|
1179 } |
|
1180 SWT_CATCH |
|
1181 } |
|
1182 |
|
1183 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1swt_1unsetPalette ) |
|
1184 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1185 { |
|
1186 SWT_TRY |
|
1187 { |
|
1188 SWT_LOG_JNI_CALL(); |
|
1189 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1190 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1191 widget->setPalette( QPalette() ); |
|
1192 } |
|
1193 SWT_CATCH |
|
1194 } |
|
1195 |
|
1196 JNIEXPORT void JNICALL OS_NATIVE(QWidget_1setAutoFillBackground) |
|
1197 ( JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEnabled) |
|
1198 { |
|
1199 SWT_TRY |
|
1200 { |
|
1201 SWT_LOG_JNI_CALL(); |
|
1202 SWT_LOG_DATA_2("handle=%x enabled=%d", aHandle, aEnabled); |
|
1203 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1204 widget->setAutoFillBackground( aEnabled == JNI_TRUE ? true : false ); |
|
1205 } |
|
1206 SWT_CATCH |
|
1207 } |
|
1208 |
|
1209 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1activateWindow ) |
|
1210 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1211 { |
|
1212 SWT_TRY |
|
1213 { |
|
1214 SWT_LOG_JNI_CALL(); |
|
1215 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1216 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1217 widget->activateWindow(); |
|
1218 } |
|
1219 SWT_CATCH |
|
1220 } |
|
1221 |
|
1222 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isActiveWindow ) |
|
1223 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1224 { |
|
1225 bool active = false; |
|
1226 SWT_TRY |
|
1227 { |
|
1228 SWT_LOG_JNI_CALL(); |
|
1229 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1230 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1231 active = widget->isActiveWindow(); |
|
1232 } |
|
1233 SWT_CATCH |
|
1234 return ( active ? JNI_TRUE : JNI_FALSE ); |
|
1235 } |
|
1236 |
|
1237 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setFont ) |
|
1238 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle ) |
|
1239 { |
|
1240 SWT_TRY |
|
1241 { |
|
1242 SWT_LOG_JNI_CALL(); |
|
1243 SWT_LOG_DATA_2( "handle=%x fonthandled=%x", aHandle, aFontHandle ); |
|
1244 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1245 QFont* font = reinterpret_cast< QFont* > ( aFontHandle ); |
|
1246 widget->setFont( *font ); |
|
1247 } |
|
1248 SWT_CATCH |
|
1249 } |
|
1250 |
|
1251 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1raise ) |
|
1252 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1253 { |
|
1254 SWT_TRY |
|
1255 { |
|
1256 SWT_LOG_JNI_CALL(); |
|
1257 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1258 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1259 widget->raise(); |
|
1260 } |
|
1261 SWT_CATCH |
|
1262 } |
|
1263 |
|
1264 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1lower ) |
|
1265 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1266 { |
|
1267 SWT_TRY |
|
1268 { |
|
1269 SWT_LOG_JNI_CALL(); |
|
1270 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1271 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1272 widget->lower(); |
|
1273 } |
|
1274 SWT_CATCH |
|
1275 } |
|
1276 |
|
1277 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1mapTo ) |
|
1278 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aParent, jint aX, jint aY) |
|
1279 { |
|
1280 jobject javaPoint = NULL; |
|
1281 SWT_TRY |
|
1282 { |
|
1283 SWT_LOG_JNI_CALL(); |
|
1284 SWT_LOG_DATA_4("handle=%x parent=%x x=%d y=%d", aHandle, aParent, aX, aY); |
|
1285 |
|
1286 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1287 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
1288 QPoint point( static_cast<int>(aX), static_cast<int>(aY) ); |
|
1289 QPoint pos = widget->mapTo( parent, point ); |
|
1290 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, pos ); |
|
1291 } |
|
1292 SWT_CATCH |
|
1293 return javaPoint; |
|
1294 } |
|
1295 |
|
1296 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1mapToGlobal ) |
|
1297 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
1298 { |
|
1299 jobject javaPoint = NULL; |
|
1300 SWT_TRY |
|
1301 { |
|
1302 SWT_LOG_JNI_CALL(); |
|
1303 SWT_LOG_DATA_3("handle=%x x=%d y=%d", aHandle, aX, aY); |
|
1304 |
|
1305 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1306 QPoint point(static_cast<int>(aX), static_cast<int>(aY)); |
|
1307 QPoint pos = widget->mapToGlobal( point ); |
|
1308 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, pos ); |
|
1309 } |
|
1310 SWT_CATCH |
|
1311 return javaPoint; |
|
1312 } |
|
1313 |
|
1314 JNIEXPORT jobject JNICALL OS_NATIVE( QWidget_1mapFromGlobal ) |
|
1315 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
1316 { |
|
1317 jobject javaPoint = NULL; |
|
1318 SWT_TRY |
|
1319 { |
|
1320 SWT_LOG_JNI_CALL(); |
|
1321 SWT_LOG_DATA_3("handle=%x x=%d y=%d", aHandle, aX, aY); |
|
1322 |
|
1323 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1324 QPoint point(static_cast<int>(aX), static_cast<int>(aY)); |
|
1325 QPoint pos = widget->mapFromGlobal( point ); |
|
1326 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, pos ); |
|
1327 } |
|
1328 SWT_CATCH |
|
1329 return javaPoint; |
|
1330 } |
|
1331 |
|
1332 JNIEXPORT jintArray JNICALL OS_NATIVE( QWidget_1actions ) |
|
1333 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1334 { |
|
1335 jintArray javaArray = NULL; |
|
1336 SWT_TRY |
|
1337 { |
|
1338 SWT_LOG_JNI_CALL(); |
|
1339 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1340 |
|
1341 HANDLE_TO_POINTER( QWidget*, parent, aHandle ); |
|
1342 QList<QAction*> children = parent->actions(); |
|
1343 |
|
1344 int childCount = children.size(); |
|
1345 QVector<int> handles(childCount); |
|
1346 int* handleData = handles.data(); |
|
1347 for(int i = 0; i < childCount; ++i) |
|
1348 { |
|
1349 handleData[i] = POINTER_TO_HANDLE(children.at(i)); |
|
1350 } |
|
1351 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, handleData, childCount ); |
|
1352 } |
|
1353 SWT_CATCH |
|
1354 return javaArray; |
|
1355 } |
|
1356 |
|
1357 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1actions_1size ) |
|
1358 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
1359 { |
|
1360 jint size = -1; |
|
1361 SWT_TRY |
|
1362 { |
|
1363 SWT_LOG_JNI_CALL(); |
|
1364 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1365 |
|
1366 HANDLE_TO_POINTER( QWidget*, parent, aHandle ); |
|
1367 QList<QAction*> children = parent->actions(); |
|
1368 |
|
1369 size = children.size(); |
|
1370 } |
|
1371 SWT_CATCH |
|
1372 return size; |
|
1373 } |
|
1374 |
|
1375 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1addAction ) |
|
1376 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aActionHandle) |
|
1377 { |
|
1378 SWT_TRY |
|
1379 { |
|
1380 SWT_LOG_JNI_CALL(); |
|
1381 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1382 SWT_LOG_DATA_1("actionHandle=%x", aActionHandle); |
|
1383 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1384 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
1385 widget->addAction(action); |
|
1386 } |
|
1387 SWT_CATCH |
|
1388 } |
|
1389 |
|
1390 JNIEXPORT void JNICALL OS_NATIVE ( QWidget_1insertAction ) |
|
1391 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBeforeHandle, jint aActionHandle) |
|
1392 { |
|
1393 SWT_TRY |
|
1394 { |
|
1395 SWT_LOG_JNI_CALL(); |
|
1396 SWT_LOG_DATA_3("handle=%x beforeHandle=%d actionHandle=%d", aHandle, aBeforeHandle, aActionHandle ); |
|
1397 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1398 HANDLE_TO_POINTER( QAction*, before, aBeforeHandle ); |
|
1399 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
1400 widget->insertAction( before, action ); |
|
1401 } |
|
1402 SWT_CATCH |
|
1403 } |
|
1404 |
|
1405 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_OS_QWidget_1updateGeometry |
|
1406 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1407 { |
|
1408 SWT_TRY |
|
1409 { |
|
1410 SWT_LOG_JNI_CALL(); |
|
1411 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1412 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1413 widget->updateGeometry(); |
|
1414 } |
|
1415 SWT_CATCH |
|
1416 } |
|
1417 |
|
1418 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isEnabled ) |
|
1419 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1420 { |
|
1421 bool enabled = false; |
|
1422 SWT_TRY |
|
1423 { |
|
1424 SWT_LOG_JNI_CALL(); |
|
1425 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1426 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1427 enabled = widget->isEnabled(); |
|
1428 } |
|
1429 SWT_CATCH |
|
1430 return ( enabled ? JNI_TRUE : JNI_FALSE ); |
|
1431 } |
|
1432 |
|
1433 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isEnabledTo ) |
|
1434 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aParentHandle) |
|
1435 { |
|
1436 bool enabled = false; |
|
1437 SWT_TRY |
|
1438 { |
|
1439 SWT_LOG_JNI_CALL(); |
|
1440 SWT_LOG_DATA_2("handle=%x parentHandle=%x", aHandle, aParentHandle); |
|
1441 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1442 HANDLE_TO_POINTER( QWidget*, parent, aParentHandle ); |
|
1443 enabled = widget->isEnabledTo(parent); |
|
1444 } |
|
1445 SWT_CATCH |
|
1446 return ( enabled ? JNI_TRUE : JNI_FALSE ); |
|
1447 } |
|
1448 |
|
1449 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setEnabled ) |
|
1450 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEnabled) |
|
1451 { |
|
1452 SWT_TRY |
|
1453 { |
|
1454 SWT_LOG_JNI_CALL(); |
|
1455 SWT_LOG_DATA_2("handle=%x enabled=%d", aHandle, aEnabled); |
|
1456 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1457 widget->setEnabled( aEnabled == JNI_TRUE ? true : false ); |
|
1458 } |
|
1459 SWT_CATCH |
|
1460 } |
|
1461 |
|
1462 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isHidden ) |
|
1463 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
1464 { |
|
1465 bool hidden = false; |
|
1466 SWT_TRY |
|
1467 { |
|
1468 SWT_LOG_JNI_CALL(); |
|
1469 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1470 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1471 hidden = widget->isHidden(); |
|
1472 } |
|
1473 SWT_CATCH |
|
1474 return ( hidden ? JNI_TRUE : JNI_FALSE ); |
|
1475 } |
|
1476 |
|
1477 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setContentsMargins ) |
|
1478 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aLeft, jint aTop, jint aRight, jint aBottom) |
|
1479 { |
|
1480 SWT_TRY |
|
1481 { |
|
1482 SWT_LOG_JNI_CALL(); |
|
1483 SWT_LOG_DATA_5("handle=%x left=%d top=%d right=%d bottom=%d", aHandle, aLeft, aTop, aRight, aBottom); |
|
1484 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1485 widget->setContentsMargins( aLeft, aTop, aRight, aBottom ); |
|
1486 } |
|
1487 SWT_CATCH |
|
1488 } |
|
1489 |
|
1490 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setToolTip ) |
|
1491 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aToolTip) |
|
1492 { |
|
1493 SWT_TRY |
|
1494 { |
|
1495 SWT_LOG_JNI_CALL(); |
|
1496 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1497 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1498 widget->setToolTip( swtApp->jniUtils().JavaStringToQString( aJniEnv, aToolTip ) ); |
|
1499 } |
|
1500 SWT_CATCH |
|
1501 } |
|
1502 |
|
1503 JNIEXPORT jstring JNICALL OS_NATIVE( QWidget_1toolTip ) |
|
1504 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1505 { |
|
1506 jstring javaString = NULL; |
|
1507 SWT_TRY |
|
1508 { |
|
1509 SWT_LOG_JNI_CALL(); |
|
1510 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1511 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1512 QString toolTip = widget->toolTip(); |
|
1513 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, toolTip ); |
|
1514 } |
|
1515 SWT_CATCH |
|
1516 return javaString; |
|
1517 } |
|
1518 |
|
1519 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1stackUnder ) |
|
1520 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidget) |
|
1521 { |
|
1522 SWT_TRY |
|
1523 { |
|
1524 SWT_LOG_JNI_CALL(); |
|
1525 SWT_LOG_DATA_2("handle=%x widget=%x", aHandle, aWidget); |
|
1526 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1527 HANDLE_TO_POINTER( QWidget*, topWidget, aWidget ); |
|
1528 widget->stackUnder( topWidget ); |
|
1529 } |
|
1530 SWT_CATCH |
|
1531 } |
|
1532 |
|
1533 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowTitle ) |
|
1534 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aTitle) |
|
1535 { |
|
1536 SWT_TRY |
|
1537 { |
|
1538 SWT_LOG_JNI_CALL(); |
|
1539 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1540 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1541 widget->setWindowTitle( swtApp->jniUtils().JavaStringToQString( aJniEnv, aTitle ) ); |
|
1542 } |
|
1543 SWT_CATCH |
|
1544 } |
|
1545 |
|
1546 JNIEXPORT jstring JNICALL OS_NATIVE( QWidget_1windowTitle ) |
|
1547 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1548 { |
|
1549 jstring javaString = NULL; |
|
1550 SWT_TRY |
|
1551 { |
|
1552 SWT_LOG_JNI_CALL(); |
|
1553 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1554 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1555 QString windowTitle = widget->windowTitle(); |
|
1556 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, windowTitle ); |
|
1557 } |
|
1558 SWT_CATCH |
|
1559 return javaString; |
|
1560 } |
|
1561 |
|
1562 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowIcon ) |
|
1563 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIcon) |
|
1564 { |
|
1565 if(!aIcon) return; |
|
1566 SWT_TRY |
|
1567 { |
|
1568 SWT_LOG_JNI_CALL(); |
|
1569 SWT_LOG_DATA_2("handle=%x, icon=%x", aHandle, aIcon); |
|
1570 HANDLE_TO_POINTER(QWidget*, widget, aHandle ); |
|
1571 const QIcon* icon = reinterpret_cast<QIcon*>(aIcon); |
|
1572 widget->setWindowIcon(*icon); |
|
1573 } |
|
1574 SWT_CATCH |
|
1575 } |
|
1576 |
|
1577 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowIconText ) |
|
1578 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
1579 { |
|
1580 SWT_TRY |
|
1581 { |
|
1582 SWT_LOG_JNI_CALL(); |
|
1583 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1584 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1585 widget->setWindowIconText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
1586 } |
|
1587 SWT_CATCH |
|
1588 } |
|
1589 |
|
1590 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setLayoutDirection ) |
|
1591 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aLayoutDirection) |
|
1592 { |
|
1593 SWT_TRY |
|
1594 { |
|
1595 SWT_LOG_JNI_CALL(); |
|
1596 SWT_LOG_DATA_2("handle=%x layoutDirection=%d ", aHandle, aLayoutDirection); |
|
1597 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1598 widget->setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
1599 } |
|
1600 SWT_CATCH |
|
1601 } |
|
1602 |
|
1603 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setLayout ) |
|
1604 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aLayoutHandle ) |
|
1605 { |
|
1606 SWT_TRY |
|
1607 { |
|
1608 SWT_LOG_JNI_CALL(); |
|
1609 SWT_LOG_DATA_2( "handle=%x layout=%d ", aHandle, aLayoutHandle ); |
|
1610 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1611 HANDLE_TO_POINTER( QLayout*, layout, aLayoutHandle ); |
|
1612 widget->setLayout( layout ); |
|
1613 } |
|
1614 SWT_CATCH |
|
1615 } |
|
1616 |
|
1617 JNIEXPORT jint JNICALL OS_NATIVE(QWidget_1layoutDirection) |
|
1618 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1619 { |
|
1620 jint layoutDirection = 0; |
|
1621 SWT_TRY |
|
1622 { |
|
1623 SWT_LOG_JNI_CALL(); |
|
1624 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1625 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
1626 layoutDirection = widget->layoutDirection(); |
|
1627 } |
|
1628 SWT_CATCH |
|
1629 return layoutDirection; |
|
1630 } |
|
1631 |
|
1632 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1removeAction ) |
|
1633 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aActionHandle ) |
|
1634 { |
|
1635 SWT_TRY |
|
1636 { |
|
1637 SWT_LOG_JNI_CALL(); |
|
1638 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1639 SWT_LOG_DATA_1("actionHandle=%x", aActionHandle); |
|
1640 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1641 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
1642 widget->removeAction(action); |
|
1643 } |
|
1644 SWT_CATCH |
|
1645 } |
|
1646 |
|
1647 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1swt_1font_1new ) |
|
1648 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
1649 { |
|
1650 QFont* font = NULL; |
|
1651 SWT_TRY |
|
1652 { |
|
1653 SWT_LOG_JNI_CALL(); |
|
1654 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1655 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1656 |
|
1657 // Implicitly shared, shallow copy |
|
1658 font = new QFont(widget->font()); |
|
1659 } |
|
1660 SWT_CATCH |
|
1661 return reinterpret_cast< jint >( font ); |
|
1662 } |
|
1663 |
|
1664 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1window ) |
|
1665 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1666 { |
|
1667 QWidget* window = NULL; |
|
1668 SWT_TRY |
|
1669 { |
|
1670 SWT_LOG_JNI_CALL(); |
|
1671 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1672 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1673 window = widget->window(); |
|
1674 } |
|
1675 SWT_CATCH |
|
1676 return POINTER_TO_HANDLE( window ); |
|
1677 } |
|
1678 |
|
1679 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1isModal ) |
|
1680 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1681 { |
|
1682 bool modal = false; |
|
1683 SWT_TRY |
|
1684 { |
|
1685 SWT_LOG_JNI_CALL(); |
|
1686 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1687 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1688 modal = widget->isModal(); |
|
1689 } |
|
1690 SWT_CATCH |
|
1691 return ( modal ? JNI_TRUE : JNI_FALSE ); |
|
1692 } |
|
1693 |
|
1694 |
|
1695 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1heightForWidth ) |
|
1696 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth ) |
|
1697 { |
|
1698 jint height = 0; |
|
1699 SWT_TRY |
|
1700 { |
|
1701 SWT_LOG_JNI_CALL(); |
|
1702 SWT_LOG_DATA_2("handle=%x width=%d", aHandle, aWidth); |
|
1703 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1704 height = widget->heightForWidth ( aWidth ); |
|
1705 } |
|
1706 SWT_CATCH |
|
1707 return height; |
|
1708 } |
|
1709 |
|
1710 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1windowState ) |
|
1711 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1712 { |
|
1713 jint state = 0; |
|
1714 SWT_TRY |
|
1715 { |
|
1716 SWT_LOG_JNI_CALL(); |
|
1717 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1718 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1719 state = widget->windowState(); |
|
1720 } |
|
1721 SWT_CATCH |
|
1722 return state; |
|
1723 } |
|
1724 |
|
1725 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowState ) |
|
1726 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWindowState) |
|
1727 { |
|
1728 SWT_TRY |
|
1729 { |
|
1730 SWT_LOG_JNI_CALL(); |
|
1731 SWT_LOG_DATA_2("handle=%x windowState=%x", aHandle, aWindowState); |
|
1732 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1733 widget->setWindowState( static_cast<Qt::WindowStates>( aWindowState ) ); |
|
1734 } |
|
1735 SWT_CATCH |
|
1736 } |
|
1737 |
|
1738 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1focusPolicy ) |
|
1739 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1740 { |
|
1741 jint policy = 0; |
|
1742 SWT_TRY |
|
1743 { |
|
1744 SWT_LOG_JNI_CALL(); |
|
1745 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1746 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1747 policy = widget->focusPolicy(); |
|
1748 } |
|
1749 SWT_CATCH |
|
1750 return policy; |
|
1751 } |
|
1752 |
|
1753 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setFocusPolicy ) |
|
1754 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPolicy) |
|
1755 { |
|
1756 SWT_TRY |
|
1757 { |
|
1758 SWT_LOG_JNI_CALL(); |
|
1759 SWT_LOG_DATA_2("handle=%x policy=%d ", aHandle, aPolicy); |
|
1760 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1761 widget->setFocusPolicy( static_cast<Qt::FocusPolicy>(aPolicy) ); |
|
1762 } |
|
1763 SWT_CATCH |
|
1764 } |
|
1765 |
|
1766 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowModality ) |
|
1767 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aModality) |
|
1768 { |
|
1769 SWT_TRY |
|
1770 { |
|
1771 SWT_LOG_JNI_CALL(); |
|
1772 SWT_LOG_DATA_2("handle=%x modality=%d ", aHandle, aModality); |
|
1773 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1774 widget->setWindowModality( static_cast<Qt::WindowModality>(aModality) ); |
|
1775 } |
|
1776 SWT_CATCH |
|
1777 } |
|
1778 |
|
1779 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1layout ) |
|
1780 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1781 { |
|
1782 QLayout* layout = NULL; |
|
1783 SWT_TRY |
|
1784 { |
|
1785 SWT_LOG_JNI_CALL(); |
|
1786 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1787 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1788 layout = widget->layout(); |
|
1789 } |
|
1790 SWT_CATCH |
|
1791 return POINTER_TO_HANDLE( layout ); |
|
1792 } |
|
1793 |
|
1794 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setFocusProxy ) |
|
1795 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aProxyHandle ) |
|
1796 { |
|
1797 SWT_TRY |
|
1798 { |
|
1799 SWT_LOG_JNI_CALL(); |
|
1800 SWT_LOG_DATA_2( "handle=%x proxy=%d ", aHandle, aProxyHandle ); |
|
1801 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1802 HANDLE_TO_POINTER( QWidget*, proxy, aProxyHandle ); |
|
1803 widget->setFocusProxy( proxy ); |
|
1804 } |
|
1805 SWT_CATCH |
|
1806 } |
|
1807 |
|
1808 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1focusProxy ) |
|
1809 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1810 { |
|
1811 QWidget* proxy = NULL; |
|
1812 SWT_TRY |
|
1813 { |
|
1814 SWT_LOG_JNI_CALL(); |
|
1815 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1816 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1817 proxy = widget->focusProxy(); |
|
1818 } |
|
1819 SWT_CATCH |
|
1820 return POINTER_TO_HANDLE( proxy ); |
|
1821 } |
|
1822 |
|
1823 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1windowFlags ) |
|
1824 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1825 { |
|
1826 jint flags = 0; |
|
1827 SWT_TRY |
|
1828 { |
|
1829 SWT_LOG_JNI_CALL(); |
|
1830 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
1831 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1832 flags = static_cast<jint>( widget->windowFlags() ); |
|
1833 } |
|
1834 SWT_CATCH |
|
1835 return flags; |
|
1836 } |
|
1837 |
|
1838 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowFlags ) |
|
1839 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aType) |
|
1840 { |
|
1841 SWT_TRY |
|
1842 { |
|
1843 SWT_LOG_JNI_CALL(); |
|
1844 SWT_LOG_DATA_2( "handle=%x flags=%x", aHandle, aType ); |
|
1845 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1846 widget->setWindowFlags( static_cast<Qt::WindowFlags>( aType ) ); |
|
1847 } |
|
1848 SWT_CATCH |
|
1849 } |
|
1850 |
|
1851 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setFixedSize ) |
|
1852 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight) |
|
1853 { |
|
1854 SWT_TRY |
|
1855 { |
|
1856 SWT_LOG_JNI_CALL(); |
|
1857 SWT_LOG_DATA_3( "handle=%x width=%d height=%d", aHandle, aWidth, aHeight ); |
|
1858 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1859 QSize size( aWidth, aHeight ); |
|
1860 widget->setFixedSize( size ); |
|
1861 } |
|
1862 SWT_CATCH |
|
1863 } |
|
1864 |
|
1865 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setAttribute ) |
|
1866 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAttribute, jboolean aOn) |
|
1867 { |
|
1868 SWT_TRY |
|
1869 { |
|
1870 SWT_LOG_JNI_CALL(); |
|
1871 SWT_LOG_DATA_2( "handle=%x attribute=%x", aHandle, aAttribute ); |
|
1872 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1873 widget->setAttribute( static_cast<Qt::WidgetAttribute>( aAttribute ), |
|
1874 aOn == JNI_TRUE ? true : false ); |
|
1875 } |
|
1876 SWT_CATCH |
|
1877 } |
|
1878 |
|
1879 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setInputMethodHints ) |
|
1880 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aHints) |
|
1881 { |
|
1882 #if QT_VERSION >= 0x040600 |
|
1883 SWT_TRY |
|
1884 { |
|
1885 SWT_LOG_JNI_CALL(); |
|
1886 SWT_LOG_DATA_2( "handle=%x hints=%x", aHandle, aHints ); |
|
1887 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1888 widget->setInputMethodHints( static_cast<Qt::InputMethodHints>( aHints ) ); |
|
1889 } |
|
1890 SWT_CATCH |
|
1891 #endif |
|
1892 } |
|
1893 |
|
1894 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1inputMethodHints ) |
|
1895 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1896 { |
|
1897 jint result = 0; |
|
1898 #if QT_VERSION >= 0x040600 |
|
1899 SWT_TRY |
|
1900 { |
|
1901 SWT_LOG_JNI_CALL(); |
|
1902 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1903 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
1904 result = widget->inputMethodHints(); |
|
1905 } |
|
1906 SWT_CATCH |
|
1907 #endif |
|
1908 return result; |
|
1909 } |
|
1910 |
|
1911 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1clearFocus ) |
|
1912 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1913 { |
|
1914 SWT_TRY |
|
1915 { |
|
1916 SWT_LOG_JNI_CALL(); |
|
1917 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1918 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1919 widget->clearFocus(); |
|
1920 } |
|
1921 SWT_CATCH |
|
1922 } |
|
1923 |
|
1924 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1scroll ) |
|
1925 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aDx, jint aDy, jint aX, jint aY, jint aW, jint aH) |
|
1926 { |
|
1927 SWT_TRY |
|
1928 { |
|
1929 SWT_LOG_JNI_CALL(); |
|
1930 SWT_LOG_DATA_3("handle=%x dx=%d dy=%d", aHandle, aDx, aDy); |
|
1931 SWT_LOG_DATA_4("x=%d y=%d width=%d height=%d", aX, aY, aW, aH); |
|
1932 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1933 widget->scroll( aDx, aDy, QRect(aX, aY, aW, aH) ); |
|
1934 } |
|
1935 SWT_CATCH |
|
1936 } |
|
1937 |
|
1938 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setWindowOpacity ) |
|
1939 (JNIEnv* aJniEnv , jclass, jint aHandle, jdouble aLevel) |
|
1940 { |
|
1941 SWT_TRY |
|
1942 { |
|
1943 SWT_LOG_JNI_CALL(); |
|
1944 SWT_LOG_DATA_2("handle=%x level=%f", aHandle, aLevel); |
|
1945 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
1946 widget->setWindowOpacity( aLevel ); |
|
1947 } |
|
1948 SWT_CATCH |
|
1949 } |
|
1950 |
|
1951 JNIEXPORT jdouble JNICALL OS_NATIVE( QWidget_1windowOpacity ) |
|
1952 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1953 { |
|
1954 jdouble javaValue = 0; |
|
1955 SWT_TRY |
|
1956 { |
|
1957 SWT_LOG_JNI_CALL(); |
|
1958 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1959 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
1960 javaValue = widget->windowOpacity(); |
|
1961 } |
|
1962 SWT_CATCH |
|
1963 return javaValue; |
|
1964 } |
|
1965 |
|
1966 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setUpdatesEnabled ) |
|
1967 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEnabled) |
|
1968 { |
|
1969 SWT_TRY |
|
1970 { |
|
1971 SWT_LOG_JNI_CALL(); |
|
1972 SWT_LOG_DATA_2("handle=%x enabled=%d", aHandle, aEnabled); |
|
1973 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
1974 widget->setUpdatesEnabled(aEnabled == JNI_FALSE ? false : true); |
|
1975 } |
|
1976 SWT_CATCH |
|
1977 } |
|
1978 |
|
1979 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1grabMouse ) |
|
1980 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1981 { |
|
1982 SWT_TRY |
|
1983 { |
|
1984 SWT_LOG_JNI_CALL(); |
|
1985 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1986 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
1987 widget->grabMouse(); |
|
1988 } |
|
1989 SWT_CATCH |
|
1990 } |
|
1991 |
|
1992 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1releaseMouse ) |
|
1993 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1994 { |
|
1995 SWT_TRY |
|
1996 { |
|
1997 SWT_LOG_JNI_CALL(); |
|
1998 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
1999 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
2000 widget->releaseMouse(); |
|
2001 } |
|
2002 SWT_CATCH |
|
2003 } |
|
2004 |
|
2005 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1mouseGrabber ) |
|
2006 (JNIEnv* aJniEnv, jclass) |
|
2007 { |
|
2008 QWidget* grabber = NULL; |
|
2009 SWT_TRY |
|
2010 { |
|
2011 SWT_LOG_JNI_CALL(); |
|
2012 grabber = QWidget::mouseGrabber(); |
|
2013 } |
|
2014 SWT_CATCH |
|
2015 return POINTER_TO_HANDLE( grabber ); |
|
2016 } |
|
2017 |
|
2018 JNIEXPORT jint JNICALL OS_NATIVE( QWidget_1swt_1paintDevice ) |
|
2019 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
2020 { |
|
2021 QPaintDevice* result = NULL; |
|
2022 SWT_TRY |
|
2023 { |
|
2024 SWT_LOG_JNI_CALL(); |
|
2025 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2026 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
2027 result = static_cast<QPaintDevice*>( widget ); |
|
2028 } |
|
2029 SWT_CATCH |
|
2030 return reinterpret_cast<jint>( result ); |
|
2031 } |
|
2032 |
|
2033 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setStyleSheet ) |
|
2034 (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aStyleSheet) |
|
2035 { |
|
2036 SWT_TRY |
|
2037 { |
|
2038 SWT_LOG_JNI_CALL(); |
|
2039 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2040 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
2041 widget->setStyleSheet( swtApp->jniUtils().JavaStringToQString( aJniEnv, aStyleSheet ) ); |
|
2042 } |
|
2043 SWT_CATCH |
|
2044 } |
|
2045 |
|
2046 JNIEXPORT jstring JNICALL OS_NATIVE( QWidget_1styleSheet ) |
|
2047 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
2048 { |
|
2049 jstring javaString = NULL; |
|
2050 SWT_TRY |
|
2051 { |
|
2052 SWT_LOG_JNI_CALL(); |
|
2053 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2054 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
2055 QString styleSheet = widget->styleSheet(); |
|
2056 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, styleSheet ); |
|
2057 } |
|
2058 SWT_CATCH |
|
2059 return javaString; |
|
2060 } |
|
2061 |
|
2062 JNIEXPORT void JNICALL OS_NATIVE( QWidget_1setInputContext ) |
|
2063 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aInputContext) |
|
2064 { |
|
2065 SWT_TRY |
|
2066 { |
|
2067 SWT_LOG_JNI_CALL(); |
|
2068 SWT_LOG_DATA_2("handel=%x inputContext=%x", aHandle, aInputContext); |
|
2069 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
2070 QInputContext* inputContext = reinterpret_cast<QInputContext*>(aInputContext); |
|
2071 widget->setInputContext(inputContext); |
|
2072 } |
|
2073 SWT_CATCH |
|
2074 } |
|
2075 |
|
2076 JNIEXPORT jboolean JNICALL OS_NATIVE( QWidget_1testAttribute ) |
|
2077 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAttribute ) |
|
2078 { |
|
2079 bool on = false; |
|
2080 SWT_TRY |
|
2081 { |
|
2082 SWT_LOG_JNI_CALL(); |
|
2083 SWT_LOG_DATA_2("handle=%x attribute=%d", aHandle, aAttribute); |
|
2084 HANDLE_TO_POINTER( QWidget*, widget, aHandle ); |
|
2085 on = widget->testAttribute( static_cast<Qt::WidgetAttribute>(aAttribute)); |
|
2086 } |
|
2087 SWT_CATCH |
|
2088 return ( on ? JNI_TRUE : JNI_FALSE ); |
|
2089 } |
|
2090 // |
|
2091 // QFontMetrics |
|
2092 // |
|
2093 |
|
2094 JNIEXPORT jint JNICALL OS_NATIVE(QWidget_1QFontMetrics_1lineSpacing) |
|
2095 (JNIEnv* aJniEnv , jclass, jint aWidgetHandle) |
|
2096 { |
|
2097 jint lineSpacing = 0; |
|
2098 SWT_TRY |
|
2099 { |
|
2100 SWT_LOG_JNI_CALL(); |
|
2101 SWT_LOG_DATA_1("handle=%x", aWidgetHandle); |
|
2102 HANDLE_TO_POINTER(QWidget*, widget, aWidgetHandle); |
|
2103 lineSpacing = widget->fontMetrics().lineSpacing(); |
|
2104 } |
|
2105 SWT_CATCH |
|
2106 return lineSpacing; |
|
2107 } |
|
2108 |
|
2109 // |
|
2110 // QDesktopWidget |
|
2111 // |
|
2112 |
|
2113 JNIEXPORT jobject JNICALL OS_NATIVE( QDesktopWidget_1availableGeometry ) |
|
2114 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
2115 { |
|
2116 jobject javaRect = NULL; |
|
2117 SWT_TRY |
|
2118 { |
|
2119 SWT_LOG_JNI_CALL(); |
|
2120 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
2121 HANDLE_TO_POINTER( QDesktopWidget*, desktopWidget, aHandle ); |
|
2122 QRect rect = desktopWidget->availableGeometry( static_cast<int>( aIndex ) ); |
|
2123 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
2124 } |
|
2125 SWT_CATCH |
|
2126 return javaRect; |
|
2127 } |
|
2128 |
|
2129 JNIEXPORT jint JNICALL OS_NATIVE( QDesktopWidget_1primaryScreen ) |
|
2130 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
2131 { |
|
2132 jint primaryScreen=0; |
|
2133 SWT_TRY |
|
2134 { |
|
2135 SWT_LOG_JNI_CALL(); |
|
2136 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2137 HANDLE_TO_POINTER( QDesktopWidget*, desktopWidget, aHandle ); |
|
2138 primaryScreen = desktopWidget->primaryScreen(); |
|
2139 } |
|
2140 SWT_CATCH |
|
2141 return primaryScreen; |
|
2142 } |
|
2143 |
|
2144 JNIEXPORT jint JNICALL OS_NATIVE( QDesktopWidget_1screenCount ) |
|
2145 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
2146 { |
|
2147 jint numScreens=0; |
|
2148 SWT_TRY |
|
2149 { |
|
2150 SWT_LOG_JNI_CALL(); |
|
2151 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2152 HANDLE_TO_POINTER( QDesktopWidget*, desktopWidget, aHandle ); |
|
2153 #if QT_VERSION >= 0x040600 |
|
2154 numScreens = desktopWidget->screenCount(); |
|
2155 #else |
|
2156 numScreens = desktopWidget->numScreens(); |
|
2157 #endif |
|
2158 } |
|
2159 SWT_CATCH |
|
2160 return numScreens; |
|
2161 } |
|
2162 |
|
2163 JNIEXPORT jint JNICALL OS_NATIVE( QDesktopWidget_1screen ) |
|
2164 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
2165 { |
|
2166 QWidget* res = NULL; |
|
2167 SWT_TRY |
|
2168 { |
|
2169 SWT_LOG_JNI_CALL(); |
|
2170 SWT_LOG_DATA_2("handle=%x index=%d", aHandle, aIndex); |
|
2171 HANDLE_TO_POINTER( QDesktopWidget*, desktopWidget, aHandle ); |
|
2172 res = desktopWidget->screen( aIndex ); |
|
2173 } |
|
2174 SWT_CATCH |
|
2175 return POINTER_TO_HANDLE( res ); |
|
2176 } |
|
2177 |
|
2178 JNIEXPORT jobject JNICALL OS_NATIVE( QDesktopWidget_1screenGeometry ) |
|
2179 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
2180 { |
|
2181 jobject javaRect = NULL; |
|
2182 SWT_TRY |
|
2183 { |
|
2184 SWT_LOG_JNI_CALL(); |
|
2185 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
2186 HANDLE_TO_POINTER( QDesktopWidget*, desktopWidget, aHandle ); |
|
2187 QRect rect = desktopWidget->screenGeometry( static_cast<int>( aIndex ) ); |
|
2188 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
2189 } |
|
2190 SWT_CATCH |
|
2191 return javaRect; |
|
2192 } |
|
2193 |
|
2194 JNIEXPORT jint JNICALL OS_NATIVE( QDesktopWidget_1screenNumber ) |
|
2195 (JNIEnv* aJniEnv, jclass, jint aDesktopHandle, jint aWidgetHandle) |
|
2196 { |
|
2197 jint screenNum=0; |
|
2198 SWT_TRY |
|
2199 { |
|
2200 SWT_LOG_JNI_CALL(); |
|
2201 SWT_LOG_DATA_2("handle=%x widgetHandle=%x", aDesktopHandle, widgetHandle); |
|
2202 HANDLE_TO_POINTER( QDesktopWidget*, desktopWidget, aDesktopHandle ); |
|
2203 HANDLE_TO_POINTER( QWidget*, widget, aWidgetHandle ); |
|
2204 screenNum = desktopWidget->screenNumber( widget ); |
|
2205 } |
|
2206 SWT_CATCH |
|
2207 return screenNum; |
|
2208 } |
|
2209 |
|
2210 // |
|
2211 // QObject |
|
2212 // |
|
2213 |
|
2214 JNIEXPORT void JNICALL OS_NATIVE(QObject_1installEventFilter) |
|
2215 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aFilter ) |
|
2216 { |
|
2217 SWT_TRY |
|
2218 { |
|
2219 SWT_LOG_JNI_CALL(); |
|
2220 SWT_LOG_DATA_2("handle=%x filter=%x", aHandle, aFilter); |
|
2221 |
|
2222 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2223 HANDLE_TO_POINTER( QObject*, eventFilter, aFilter ); |
|
2224 object->installEventFilter( eventFilter ); |
|
2225 } |
|
2226 SWT_CATCH |
|
2227 } |
|
2228 |
|
2229 JNIEXPORT void JNICALL OS_NATIVE(QObject_1removeEventFilter) |
|
2230 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFilter) |
|
2231 { |
|
2232 SWT_TRY |
|
2233 { |
|
2234 SWT_LOG_JNI_CALL(); |
|
2235 SWT_LOG_DATA_2("handle=%x filter=%x", aHandle, aFilter); |
|
2236 |
|
2237 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2238 HANDLE_TO_POINTER( QObject*, eventFilter, aFilter ); |
|
2239 object->removeEventFilter( eventFilter ); |
|
2240 } |
|
2241 SWT_CATCH |
|
2242 } |
|
2243 |
|
2244 JNIEXPORT void JNICALL OS_NATIVE(QObject_1setProperty) |
|
2245 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aName, jint aData) |
|
2246 { |
|
2247 SWT_TRY |
|
2248 { |
|
2249 SWT_LOG_JNI_CALL(); |
|
2250 SWT_LOG_DATA_2("handle=%x data=%x", aHandle, aData); |
|
2251 |
|
2252 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2253 QString name = swtApp->jniUtils().JavaStringToQString( aJniEnv, aName ); |
|
2254 QByteArray chars = name.toLatin1(); |
|
2255 object->setProperty( chars.data(), QVariant(static_cast<int>( aData )) ); |
|
2256 } |
|
2257 SWT_CATCH |
|
2258 } |
|
2259 |
|
2260 JNIEXPORT jint JNICALL OS_NATIVE(QObject_1property) |
|
2261 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aName ) |
|
2262 { |
|
2263 jint retVal = -1; |
|
2264 SWT_TRY |
|
2265 { |
|
2266 SWT_LOG_JNI_CALL(); |
|
2267 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2268 |
|
2269 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2270 QString name = swtApp->jniUtils().JavaStringToQString( aJniEnv, aName ); |
|
2271 QByteArray chars = name.toLatin1(); |
|
2272 QVariant data = object->property(chars.data()); |
|
2273 if (data.isValid()) |
|
2274 { |
|
2275 retVal = data.toInt(); |
|
2276 } |
|
2277 } |
|
2278 SWT_CATCH |
|
2279 return retVal; |
|
2280 } |
|
2281 |
|
2282 JNIEXPORT void JNICALL OS_NATIVE(QObject_1delete) |
|
2283 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2284 { |
|
2285 SWT_TRY |
|
2286 { |
|
2287 SWT_LOG_JNI_CALL(); |
|
2288 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2289 |
|
2290 HANDLE_TO_POINTER(QObject*, object, aHandle); |
|
2291 delete object; |
|
2292 object = NULL; |
|
2293 } |
|
2294 SWT_CATCH |
|
2295 } |
|
2296 |
|
2297 JNIEXPORT void JNICALL OS_NATIVE(QObject_1setParent) |
|
2298 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aParent ) |
|
2299 { |
|
2300 SWT_TRY |
|
2301 { |
|
2302 SWT_LOG_JNI_CALL(); |
|
2303 SWT_LOG_DATA_2("handle=%x parent=%x", aHandle, aParent); |
|
2304 |
|
2305 HANDLE_TO_POINTER( QObject*, child, aHandle ); |
|
2306 HANDLE_TO_POINTER( QObject*, parent, aParent ); |
|
2307 child->setParent( parent ); |
|
2308 } |
|
2309 SWT_CATCH |
|
2310 } |
|
2311 |
|
2312 JNIEXPORT jint JNICALL OS_NATIVE( QObject_1parent ) |
|
2313 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2314 { |
|
2315 QObject* parent = NULL; |
|
2316 SWT_TRY |
|
2317 { |
|
2318 SWT_LOG_JNI_CALL(); |
|
2319 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2320 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2321 parent = object->parent(); |
|
2322 } |
|
2323 SWT_CATCH |
|
2324 return POINTER_TO_HANDLE( parent ); |
|
2325 } |
|
2326 |
|
2327 JNIEXPORT jboolean JNICALL OS_NATIVE(QObject_1connect) |
|
2328 (JNIEnv* aJniEnv , jclass, jint aSender, jstring aSignal, jint aReceiver, jstring aSlot, |
|
2329 jint aConnectionType) |
|
2330 { |
|
2331 bool success = true; |
|
2332 SWT_TRY |
|
2333 { |
|
2334 SWT_LOG_JNI_CALL(); |
|
2335 SWT_LOG_DATA_2("sender=%x receiver=%x", aSender, aReceiver); |
|
2336 |
|
2337 HANDLE_TO_POINTER( QObject*, sender, aSender ); |
|
2338 HANDLE_TO_POINTER( QObject*, receiver, aReceiver ); |
|
2339 |
|
2340 QString signalName = swtApp->jniUtils().JavaStringToQString( aJniEnv, aSignal); |
|
2341 QString slotName = swtApp->jniUtils().JavaStringToQString( aJniEnv, aSlot ); |
|
2342 |
|
2343 // Prepare the signal and slot prototype strings for QObject.connect() |
|
2344 // like using the SIGNAL and SLOT macros would do. |
|
2345 const char* signalCodeString = SIGNAL(""); |
|
2346 const char* slotCodeString = SLOT(""); |
|
2347 signalName.prepend( QChar( signalCodeString[0] ) ); |
|
2348 slotName.prepend( QChar( slotCodeString[0] ) ); |
|
2349 QByteArray signalBytes = signalName.toLatin1(); |
|
2350 QByteArray slotBytes = slotName.toLatin1(); |
|
2351 const char* signalChars = signalBytes.data(); |
|
2352 const char* slotChars = slotBytes.data(); |
|
2353 |
|
2354 SWT_LOG_DATA_2("signal=%s slot=%s", signalChars, slotChars); |
|
2355 |
|
2356 success = QObject::connect( sender, signalChars, receiver, slotChars, |
|
2357 static_cast<Qt::ConnectionType>(aConnectionType) ); |
|
2358 } |
|
2359 SWT_CATCH |
|
2360 return ( success ? JNI_TRUE : JNI_FALSE ); |
|
2361 } |
|
2362 |
|
2363 JNIEXPORT jint JNICALL OS_NATIVE( QObject_1thread ) |
|
2364 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2365 { |
|
2366 QThread* thread = NULL; |
|
2367 SWT_TRY |
|
2368 { |
|
2369 SWT_LOG_JNI_CALL(); |
|
2370 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2371 |
|
2372 HANDLE_TO_POINTER(QObject*, object, aHandle); |
|
2373 thread = object->thread(); |
|
2374 } |
|
2375 SWT_CATCH |
|
2376 return POINTER_TO_HANDLE( thread ); |
|
2377 } |
|
2378 |
|
2379 JNIEXPORT jintArray JNICALL OS_NATIVE( QObject_1children ) |
|
2380 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2381 { |
|
2382 jintArray javaArray = NULL; |
|
2383 SWT_TRY |
|
2384 { |
|
2385 SWT_LOG_JNI_CALL(); |
|
2386 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2387 |
|
2388 HANDLE_TO_POINTER( QObject*, parent, aHandle ); |
|
2389 QObjectList children = parent->children(); |
|
2390 |
|
2391 int childCount = children.size(); |
|
2392 QVector<int> handles(childCount); |
|
2393 int* handleData = handles.data(); |
|
2394 for(int i = 0; i < childCount; ++i) |
|
2395 { |
|
2396 handleData[i] = POINTER_TO_HANDLE(children.at(i)); |
|
2397 } |
|
2398 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, handleData, childCount ); |
|
2399 } |
|
2400 SWT_CATCH |
|
2401 return javaArray; |
|
2402 } |
|
2403 |
|
2404 JNIEXPORT void JNICALL OS_NATIVE( QObject_1dumpObjectInfo ) |
|
2405 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2406 { |
|
2407 SWT_TRY |
|
2408 { |
|
2409 SWT_LOG_JNI_CALL(); |
|
2410 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2411 |
|
2412 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2413 object->dumpObjectInfo(); |
|
2414 } |
|
2415 SWT_CATCH |
|
2416 } |
|
2417 |
|
2418 JNIEXPORT void JNICALL OS_NATIVE( QObject_1dumpObjectTree ) |
|
2419 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2420 { |
|
2421 SWT_TRY |
|
2422 { |
|
2423 SWT_LOG_JNI_CALL(); |
|
2424 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2425 |
|
2426 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2427 object->dumpObjectTree(); |
|
2428 } |
|
2429 SWT_CATCH |
|
2430 } |
|
2431 |
|
2432 JNIEXPORT void JNICALL OS_NATIVE( QObject_1deleteLater ) |
|
2433 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2434 { |
|
2435 SWT_TRY |
|
2436 { |
|
2437 SWT_LOG_JNI_CALL(); |
|
2438 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2439 |
|
2440 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2441 object->deleteLater(); |
|
2442 } |
|
2443 SWT_CATCH |
|
2444 } |
|
2445 |
|
2446 JNIEXPORT void JNICALL OS_NATIVE( QObject_1setObjectName ) |
|
2447 (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aName) |
|
2448 { |
|
2449 SWT_TRY |
|
2450 { |
|
2451 SWT_LOG_JNI_CALL(); |
|
2452 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2453 |
|
2454 HANDLE_TO_POINTER( QObject*, object, aHandle ); |
|
2455 QString name = swtApp->jniUtils().JavaStringToQString( aJniEnv, aName ); |
|
2456 object->setObjectName(name); |
|
2457 } |
|
2458 SWT_CATCH |
|
2459 } |
|
2460 |
|
2461 // |
|
2462 // QAbstractButton |
|
2463 // |
|
2464 |
|
2465 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1setCheckable ) |
|
2466 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aCheckable) |
|
2467 { |
|
2468 SWT_TRY |
|
2469 { |
|
2470 SWT_LOG_JNI_CALL(); |
|
2471 SWT_LOG_DATA_2("handle=%x checkable=%d", aHandle, aCheckable); |
|
2472 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2473 button->setCheckable( aCheckable == JNI_TRUE ? true : false ); |
|
2474 } |
|
2475 SWT_CATCH |
|
2476 } |
|
2477 |
|
2478 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1setText ) |
|
2479 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
2480 { |
|
2481 SWT_TRY |
|
2482 { |
|
2483 SWT_LOG_JNI_CALL(); |
|
2484 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2485 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2486 button->setText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
2487 } |
|
2488 SWT_CATCH |
|
2489 } |
|
2490 |
|
2491 JNIEXPORT jstring JNICALL OS_NATIVE( QAbstractButton_1text ) |
|
2492 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2493 { |
|
2494 jstring javaString = NULL; |
|
2495 SWT_TRY |
|
2496 { |
|
2497 SWT_LOG_JNI_CALL(); |
|
2498 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2499 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2500 QString text = button->text(); |
|
2501 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, text ); |
|
2502 } |
|
2503 SWT_CATCH |
|
2504 return javaString; |
|
2505 } |
|
2506 |
|
2507 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1setChecked ) |
|
2508 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aChecked) |
|
2509 { |
|
2510 SWT_TRY |
|
2511 { |
|
2512 SWT_LOG_JNI_CALL(); |
|
2513 SWT_LOG_DATA_2("handle=%x checked=%d", aHandle, aChecked); |
|
2514 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2515 button->setChecked( aChecked == JNI_TRUE ? true : false ); |
|
2516 } |
|
2517 SWT_CATCH |
|
2518 } |
|
2519 |
|
2520 JNIEXPORT jboolean JNICALL OS_NATIVE( QAbstractButton_1isChecked ) |
|
2521 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2522 { |
|
2523 bool checked = false; |
|
2524 SWT_TRY |
|
2525 { |
|
2526 SWT_LOG_JNI_CALL(); |
|
2527 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2528 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2529 checked = button->isChecked(); |
|
2530 } |
|
2531 SWT_CATCH |
|
2532 return ( checked ? JNI_TRUE : JNI_FALSE ); |
|
2533 } |
|
2534 |
|
2535 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1setIcon ) |
|
2536 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIconHandle ) |
|
2537 { |
|
2538 SWT_TRY |
|
2539 { |
|
2540 SWT_LOG_JNI_CALL(); |
|
2541 SWT_LOG_DATA_2("handle=%x, aIconHandle=%x", aHandle, aIconHandle ); |
|
2542 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2543 QIcon* icon = reinterpret_cast<QIcon*>(aIconHandle); |
|
2544 button->setIcon( *icon ); |
|
2545 } |
|
2546 SWT_CATCH |
|
2547 } |
|
2548 |
|
2549 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1setIconSize ) |
|
2550 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight ) |
|
2551 { |
|
2552 SWT_TRY |
|
2553 { |
|
2554 SWT_LOG_JNI_CALL(); |
|
2555 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2556 button->setIconSize( QSize( aWidth, aHeight ) ); |
|
2557 } |
|
2558 SWT_CATCH |
|
2559 } |
|
2560 |
|
2561 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1setAutoExclusive ) |
|
2562 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aAuto) |
|
2563 { |
|
2564 SWT_TRY |
|
2565 { |
|
2566 SWT_LOG_JNI_CALL(); |
|
2567 SWT_LOG_DATA_2("handle=%x, autoExclusive=%d", aHandle, aAuto ); |
|
2568 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2569 button->setAutoExclusive( aAuto == JNI_TRUE ? true : false ); |
|
2570 } |
|
2571 SWT_CATCH |
|
2572 } |
|
2573 |
|
2574 JNIEXPORT void JNICALL OS_NATIVE( QAbstractButton_1click ) |
|
2575 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2576 { |
|
2577 SWT_TRY |
|
2578 { |
|
2579 SWT_LOG_JNI_CALL(); |
|
2580 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2581 HANDLE_TO_POINTER( QAbstractButton*, button, aHandle ); |
|
2582 button->click(); |
|
2583 } |
|
2584 SWT_CATCH |
|
2585 } |
|
2586 |
|
2587 // |
|
2588 // QPushButton |
|
2589 // |
|
2590 |
|
2591 JNIEXPORT jint JNICALL OS_NATIVE( QPushButton_1new ) |
|
2592 ( JNIEnv* aJniEnv , jclass ) |
|
2593 { |
|
2594 QPushButton* button = NULL; |
|
2595 SWT_TRY |
|
2596 { |
|
2597 SWT_LOG_JNI_CALL(); |
|
2598 button = new QPushButton(); |
|
2599 } |
|
2600 SWT_CATCH |
|
2601 return POINTER_TO_HANDLE( button ); |
|
2602 } |
|
2603 |
|
2604 JNIEXPORT void JNICALL OS_NATIVE( QPushButton_1setFlat ) |
|
2605 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aFlat) |
|
2606 { |
|
2607 SWT_TRY |
|
2608 { |
|
2609 SWT_LOG_JNI_CALL(); |
|
2610 SWT_LOG_DATA_2("handle=%x flat=%d", aHandle, aFlat); |
|
2611 HANDLE_TO_POINTER( QPushButton*, button, aHandle ); |
|
2612 button->setFlat( aFlat == JNI_TRUE ? true : false ); |
|
2613 } |
|
2614 SWT_CATCH |
|
2615 } |
|
2616 |
|
2617 JNIEXPORT void JNICALL OS_NATIVE( QPushButton_1setDefault ) |
|
2618 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aDefault) |
|
2619 { |
|
2620 SWT_TRY |
|
2621 { |
|
2622 SWT_LOG_JNI_CALL(); |
|
2623 SWT_LOG_DATA_2("handle=%x default=%d", aHandle, aDefault); |
|
2624 HANDLE_TO_POINTER( QPushButton*, button, aHandle ); |
|
2625 button->setDefault( aDefault == JNI_TRUE ? true : false ); |
|
2626 } |
|
2627 SWT_CATCH |
|
2628 } |
|
2629 |
|
2630 JNIEXPORT jboolean JNICALL OS_NATIVE( QPushButton_1isDefault ) |
|
2631 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2632 { |
|
2633 bool result = false; |
|
2634 SWT_TRY |
|
2635 { |
|
2636 SWT_LOG_JNI_CALL(); |
|
2637 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2638 HANDLE_TO_POINTER( QPushButton*, button, aHandle ); |
|
2639 result = button->isDefault(); |
|
2640 } |
|
2641 SWT_CATCH |
|
2642 return ( result ? JNI_TRUE : JNI_FALSE ); |
|
2643 } |
|
2644 |
|
2645 // |
|
2646 // QRadioButton |
|
2647 // |
|
2648 |
|
2649 JNIEXPORT jint JNICALL OS_NATIVE( QRadioButton_1new ) |
|
2650 (JNIEnv* aJniEnv , jclass) |
|
2651 { |
|
2652 QRadioButton* button = NULL; |
|
2653 SWT_TRY |
|
2654 { |
|
2655 SWT_LOG_JNI_CALL(); |
|
2656 button = new QRadioButton(); |
|
2657 } |
|
2658 SWT_CATCH |
|
2659 return POINTER_TO_HANDLE( button ); |
|
2660 } |
|
2661 |
|
2662 // |
|
2663 // QCheckBox |
|
2664 // |
|
2665 |
|
2666 JNIEXPORT jint JNICALL OS_NATIVE( QCheckBox_1new ) |
|
2667 (JNIEnv* aJniEnv , jclass) |
|
2668 { |
|
2669 QCheckBox* box = NULL; |
|
2670 SWT_TRY |
|
2671 { |
|
2672 SWT_LOG_JNI_CALL(); |
|
2673 box = new QCheckBox(); |
|
2674 } |
|
2675 SWT_CATCH |
|
2676 return POINTER_TO_HANDLE( box ); |
|
2677 } |
|
2678 |
|
2679 // |
|
2680 // QFrame |
|
2681 // |
|
2682 |
|
2683 JNIEXPORT jint JNICALL JNICALL OS_NATIVE( QFrame_1new ) |
|
2684 ( JNIEnv* aJniEnv , jclass) |
|
2685 { |
|
2686 QFrame* frame( NULL ); |
|
2687 SWT_TRY |
|
2688 { |
|
2689 SWT_LOG_JNI_CALL(); |
|
2690 frame = new QFrame(); |
|
2691 } |
|
2692 SWT_CATCH |
|
2693 return POINTER_TO_HANDLE( frame ); |
|
2694 } |
|
2695 |
|
2696 JNIEXPORT void JNICALL OS_NATIVE( QFrame_1setFrameStyle ) |
|
2697 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aStyle ) |
|
2698 { |
|
2699 SWT_TRY |
|
2700 { |
|
2701 SWT_LOG_JNI_CALL(); |
|
2702 SWT_LOG_DATA_2("handle=%x style=%x", aHandle, aStyle); |
|
2703 HANDLE_TO_POINTER( QFrame*, frame, aHandle ); |
|
2704 frame->setFrameStyle( aStyle ); |
|
2705 } |
|
2706 SWT_CATCH |
|
2707 } |
|
2708 |
|
2709 JNIEXPORT jint JNICALL OS_NATIVE( QFrame_1frameWidth ) |
|
2710 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2711 { |
|
2712 jint width = -1; |
|
2713 SWT_TRY |
|
2714 { |
|
2715 SWT_LOG_JNI_CALL(); |
|
2716 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2717 HANDLE_TO_POINTER( QFrame*, frame, aHandle ); |
|
2718 width = frame->frameWidth(); |
|
2719 } |
|
2720 SWT_CATCH |
|
2721 return width; |
|
2722 } |
|
2723 |
|
2724 JNIEXPORT void JNICALL OS_NATIVE( QFrame_1setLineWidth ) |
|
2725 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth) |
|
2726 { |
|
2727 SWT_TRY |
|
2728 { |
|
2729 SWT_LOG_JNI_CALL(); |
|
2730 SWT_LOG_DATA_2("handle=%x width=%x ", aHandle, aWidth); |
|
2731 HANDLE_TO_POINTER( QFrame*, frame, aHandle ); |
|
2732 frame->setLineWidth( aWidth ); |
|
2733 } |
|
2734 SWT_CATCH |
|
2735 } |
|
2736 |
|
2737 JNIEXPORT jint JNICALL OS_NATIVE( QFrame_1frameShape ) |
|
2738 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2739 { |
|
2740 jint shape = -1; |
|
2741 SWT_TRY |
|
2742 { |
|
2743 SWT_LOG_JNI_CALL(); |
|
2744 SWT_LOG_DATA_1("handle=%x ", aHandle); |
|
2745 HANDLE_TO_POINTER( QFrame*, frame, aHandle ); |
|
2746 shape = frame->frameShape(); |
|
2747 } |
|
2748 SWT_CATCH |
|
2749 return shape; |
|
2750 } |
|
2751 |
|
2752 // |
|
2753 // QAbstractScrollArea |
|
2754 // |
|
2755 |
|
2756 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractScrollArea_1viewPort ) |
|
2757 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2758 { |
|
2759 QWidget* viewPort = NULL; |
|
2760 SWT_TRY |
|
2761 { |
|
2762 SWT_LOG_JNI_CALL(); |
|
2763 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2764 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2765 viewPort = area->viewport(); |
|
2766 } |
|
2767 SWT_CATCH |
|
2768 return POINTER_TO_HANDLE( viewPort ); |
|
2769 } |
|
2770 |
|
2771 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractScrollArea_1horizontalScrollBar ) |
|
2772 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2773 { |
|
2774 QScrollBar* bar = NULL; |
|
2775 SWT_TRY |
|
2776 { |
|
2777 SWT_LOG_JNI_CALL(); |
|
2778 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2779 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2780 bar = area->horizontalScrollBar(); |
|
2781 } |
|
2782 SWT_CATCH |
|
2783 return POINTER_TO_HANDLE( bar ); |
|
2784 } |
|
2785 |
|
2786 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractScrollArea_1verticalScrollBar ) |
|
2787 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2788 { |
|
2789 QScrollBar* bar = NULL; |
|
2790 SWT_TRY |
|
2791 { |
|
2792 SWT_LOG_JNI_CALL(); |
|
2793 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2794 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2795 bar = area->verticalScrollBar(); |
|
2796 } |
|
2797 SWT_CATCH |
|
2798 return POINTER_TO_HANDLE( bar ); |
|
2799 } |
|
2800 |
|
2801 JNIEXPORT void JNICALL OS_NATIVE( QAbstractScrollArea_1setHorizontalScrollBarPolicy ) |
|
2802 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPolicy) |
|
2803 { |
|
2804 SWT_TRY |
|
2805 { |
|
2806 SWT_LOG_JNI_CALL(); |
|
2807 SWT_LOG_DATA_2("handle=%x policy=%x", aHandle, aPolicy); |
|
2808 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2809 area->setHorizontalScrollBarPolicy( static_cast<Qt::ScrollBarPolicy>(aPolicy) ); |
|
2810 } |
|
2811 SWT_CATCH |
|
2812 } |
|
2813 |
|
2814 JNIEXPORT void JNICALL OS_NATIVE( QAbstractScrollArea_1setVerticalScrollBarPolicy ) |
|
2815 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPolicy) |
|
2816 { |
|
2817 SWT_TRY |
|
2818 { |
|
2819 SWT_LOG_JNI_CALL(); |
|
2820 SWT_LOG_DATA_2("handle=%x policy=%x", aHandle, aPolicy); |
|
2821 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2822 area->setVerticalScrollBarPolicy( static_cast<Qt::ScrollBarPolicy>(aPolicy) ); |
|
2823 } |
|
2824 SWT_CATCH |
|
2825 } |
|
2826 |
|
2827 JNIEXPORT void JNICALL OS_NATIVE( QAbstractScrollArea_1setCornerWidget ) |
|
2828 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidget) |
|
2829 { |
|
2830 SWT_TRY |
|
2831 { |
|
2832 SWT_LOG_JNI_CALL(); |
|
2833 SWT_LOG_DATA_2("handle=%x widget=%x", aHandle, aWidget); |
|
2834 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2835 HANDLE_TO_POINTER( QWidget*, widget, aWidget ); |
|
2836 area->setCornerWidget( widget ); |
|
2837 } |
|
2838 SWT_CATCH |
|
2839 } |
|
2840 |
|
2841 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractScrollArea_1cornerWidget ) |
|
2842 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2843 { |
|
2844 QWidget* widget = NULL; |
|
2845 SWT_TRY |
|
2846 { |
|
2847 SWT_LOG_JNI_CALL(); |
|
2848 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
2849 HANDLE_TO_POINTER( QAbstractScrollArea*, area, aHandle ); |
|
2850 widget = area->cornerWidget(); |
|
2851 } |
|
2852 SWT_CATCH |
|
2853 return POINTER_TO_HANDLE( widget ); |
|
2854 } |
|
2855 |
|
2856 // |
|
2857 // QScrollArea |
|
2858 // |
|
2859 |
|
2860 JNIEXPORT jint JNICALL OS_NATIVE( QScrollArea_1new ) |
|
2861 (JNIEnv* aJniEnv , jclass, jint aParent) |
|
2862 { |
|
2863 QScrollArea* scrollArea = NULL; |
|
2864 SWT_TRY |
|
2865 { |
|
2866 SWT_LOG_JNI_CALL(); |
|
2867 SWT_LOG_DATA_1("parent=%x", aParent); |
|
2868 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
2869 scrollArea = new QScrollArea( parent ); |
|
2870 } |
|
2871 SWT_CATCH |
|
2872 return POINTER_TO_HANDLE( scrollArea ); |
|
2873 } |
|
2874 |
|
2875 // |
|
2876 // QAbstractSlider |
|
2877 // |
|
2878 |
|
2879 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractSlider_1singleStep ) |
|
2880 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2881 { |
|
2882 jint singleStep = -1; |
|
2883 SWT_TRY |
|
2884 { |
|
2885 SWT_LOG_JNI_CALL(); |
|
2886 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
2887 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2888 singleStep = slider->singleStep(); |
|
2889 } |
|
2890 SWT_CATCH |
|
2891 return singleStep; |
|
2892 } |
|
2893 |
|
2894 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractSlider_1maximum ) |
|
2895 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2896 { |
|
2897 jint maximum = -1; |
|
2898 SWT_TRY |
|
2899 { |
|
2900 SWT_LOG_JNI_CALL(); |
|
2901 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
2902 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2903 maximum = slider->maximum(); |
|
2904 } |
|
2905 SWT_CATCH |
|
2906 return maximum; |
|
2907 } |
|
2908 |
|
2909 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractSlider_1minimum ) |
|
2910 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2911 { |
|
2912 jint minimum = -1; |
|
2913 SWT_TRY |
|
2914 { |
|
2915 SWT_LOG_JNI_CALL(); |
|
2916 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
2917 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2918 minimum = slider->minimum(); |
|
2919 } |
|
2920 SWT_CATCH |
|
2921 return minimum; |
|
2922 } |
|
2923 |
|
2924 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractSlider_1pageStep ) |
|
2925 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2926 { |
|
2927 jint pageStep = -1; |
|
2928 SWT_TRY |
|
2929 { |
|
2930 SWT_LOG_JNI_CALL(); |
|
2931 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
2932 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2933 pageStep = slider->pageStep(); |
|
2934 } |
|
2935 SWT_CATCH |
|
2936 return pageStep; |
|
2937 } |
|
2938 |
|
2939 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractSlider_1value ) |
|
2940 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
2941 { |
|
2942 jint value = -1; |
|
2943 SWT_TRY |
|
2944 { |
|
2945 SWT_LOG_JNI_CALL(); |
|
2946 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
2947 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2948 value = slider->value(); |
|
2949 } |
|
2950 SWT_CATCH |
|
2951 return value; |
|
2952 } |
|
2953 |
|
2954 JNIEXPORT void JNICALL OS_NATIVE( QAbstractSlider_1setSingleStep ) |
|
2955 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
2956 { |
|
2957 SWT_TRY |
|
2958 { |
|
2959 SWT_LOG_JNI_CALL(); |
|
2960 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
2961 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2962 slider->setSingleStep( aValue ); |
|
2963 } |
|
2964 SWT_CATCH |
|
2965 } |
|
2966 |
|
2967 JNIEXPORT void JNICALL OS_NATIVE( QAbstractSlider_1setMaximum ) |
|
2968 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
2969 { |
|
2970 SWT_TRY |
|
2971 { |
|
2972 SWT_LOG_JNI_CALL(); |
|
2973 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
2974 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2975 slider->setMaximum( aValue ); |
|
2976 } |
|
2977 SWT_CATCH |
|
2978 } |
|
2979 |
|
2980 JNIEXPORT void JNICALL OS_NATIVE( QAbstractSlider_1setMinimum ) |
|
2981 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
2982 { |
|
2983 SWT_TRY |
|
2984 { |
|
2985 SWT_LOG_JNI_CALL(); |
|
2986 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
2987 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
2988 slider->setMinimum( aValue ); |
|
2989 } |
|
2990 SWT_CATCH |
|
2991 } |
|
2992 |
|
2993 JNIEXPORT void JNICALL OS_NATIVE( QAbstractSlider_1setPageStep ) |
|
2994 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
2995 { |
|
2996 SWT_TRY |
|
2997 { |
|
2998 SWT_LOG_JNI_CALL(); |
|
2999 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
3000 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
3001 slider->setPageStep( aValue ); |
|
3002 } |
|
3003 SWT_CATCH |
|
3004 } |
|
3005 |
|
3006 JNIEXPORT void JNICALL OS_NATIVE( QAbstractSlider_1setValue ) |
|
3007 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
3008 { |
|
3009 SWT_TRY |
|
3010 { |
|
3011 SWT_LOG_JNI_CALL(); |
|
3012 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
3013 HANDLE_TO_POINTER( QAbstractSlider*, slider, aHandle ); |
|
3014 slider->setValue( aValue ); |
|
3015 } |
|
3016 SWT_CATCH |
|
3017 } |
|
3018 |
|
3019 // |
|
3020 // QScrollBar |
|
3021 // |
|
3022 |
|
3023 JNIEXPORT jint JNICALL OS_NATIVE(QScrollBar_1value) |
|
3024 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3025 { |
|
3026 jint value = 0; |
|
3027 SWT_TRY |
|
3028 { |
|
3029 SWT_LOG_JNI_CALL(); |
|
3030 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3031 HANDLE_TO_POINTER(QScrollBar*, scrollBar, aHandle); |
|
3032 value = scrollBar->value(); |
|
3033 } |
|
3034 SWT_CATCH |
|
3035 return value; |
|
3036 } |
|
3037 |
|
3038 JNIEXPORT void JNICALL OS_NATIVE(QScrollBar_1setValue) |
|
3039 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
3040 { |
|
3041 SWT_TRY |
|
3042 { |
|
3043 SWT_LOG_JNI_CALL(); |
|
3044 SWT_LOG_DATA_2("handle=%x, value=%d", aHandle, aValue); |
|
3045 HANDLE_TO_POINTER(QScrollBar*, scrollBar, aHandle); |
|
3046 scrollBar->setValue(aValue); |
|
3047 } |
|
3048 SWT_CATCH |
|
3049 } |
|
3050 |
|
3051 |
|
3052 // |
|
3053 // QLabel |
|
3054 // |
|
3055 |
|
3056 JNIEXPORT jstring JNICALL OS_NATIVE( QLabel_1text ) |
|
3057 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
3058 { |
|
3059 jstring txt = NULL; |
|
3060 SWT_TRY |
|
3061 { |
|
3062 SWT_LOG_JNI_CALL(); |
|
3063 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3064 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3065 txt = swtApp->jniUtils().QStringToJavaString( aJniEnv, label->text() ); |
|
3066 } |
|
3067 SWT_CATCH |
|
3068 return txt; |
|
3069 } |
|
3070 |
|
3071 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setText ) |
|
3072 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
3073 { |
|
3074 SWT_TRY |
|
3075 { |
|
3076 SWT_LOG_JNI_CALL(); |
|
3077 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3078 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3079 label->setText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
3080 } |
|
3081 SWT_CATCH |
|
3082 } |
|
3083 |
|
3084 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setAlignment) |
|
3085 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlignment) |
|
3086 { |
|
3087 SWT_TRY |
|
3088 { |
|
3089 SWT_LOG_JNI_CALL(); |
|
3090 SWT_LOG_DATA_2("handle=%x alignment=%x", aHandle, aAlignment); |
|
3091 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3092 label->setAlignment( static_cast< Qt::Alignment >( aAlignment) ); |
|
3093 } |
|
3094 SWT_CATCH |
|
3095 } |
|
3096 |
|
3097 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setPixmap) |
|
3098 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle) |
|
3099 { |
|
3100 SWT_TRY |
|
3101 { |
|
3102 SWT_LOG_JNI_CALL(); |
|
3103 SWT_LOG_DATA_2("handle=%x imageHandle=%x", aHandle, aImageHandle ); |
|
3104 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3105 if(aImageHandle == 0 ) |
|
3106 { |
|
3107 label->setPixmap(QPixmap()); |
|
3108 } |
|
3109 else |
|
3110 { |
|
3111 QPixmap* image = static_cast< QPixmap* >( reinterpret_cast< QPaintDevice* >( aImageHandle ) ); |
|
3112 label->setPixmap( *image ); |
|
3113 } |
|
3114 } |
|
3115 SWT_CATCH |
|
3116 } |
|
3117 |
|
3118 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setWordWrap ) |
|
3119 ( JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aWrap ) |
|
3120 { |
|
3121 SWT_TRY |
|
3122 { |
|
3123 SWT_LOG_JNI_CALL(); |
|
3124 SWT_LOG_DATA_2("handle=%x wrap=%d", aHandle, aWrap); |
|
3125 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3126 label->setWordWrap ( aWrap == JNI_TRUE ? true : false ); |
|
3127 } |
|
3128 SWT_CATCH |
|
3129 } |
|
3130 |
|
3131 JNIEXPORT jint JNICALL JNICALL OS_NATIVE( QLabel_1new ) |
|
3132 ( JNIEnv* aJniEnv , jclass) |
|
3133 { |
|
3134 QLabel* label = NULL; |
|
3135 SWT_TRY |
|
3136 { |
|
3137 SWT_LOG_JNI_CALL(); |
|
3138 label = new QLabel(); |
|
3139 } |
|
3140 SWT_CATCH |
|
3141 return POINTER_TO_HANDLE( label ); |
|
3142 } |
|
3143 |
|
3144 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setBuddy ) |
|
3145 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aBuddy ) |
|
3146 { |
|
3147 SWT_TRY |
|
3148 { |
|
3149 SWT_LOG_JNI_CALL(); |
|
3150 SWT_LOG_DATA_2("handle=%x buddy=%x", aHandle, aBuddy); |
|
3151 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3152 HANDLE_TO_POINTER( QWidget*, buddy, aBuddy ); |
|
3153 label->setBuddy( buddy ); |
|
3154 } |
|
3155 SWT_CATCH |
|
3156 } |
|
3157 |
|
3158 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setTextInteractionFlags ) |
|
3159 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aFlags ) |
|
3160 { |
|
3161 SWT_TRY |
|
3162 { |
|
3163 SWT_LOG_JNI_CALL(); |
|
3164 SWT_LOG_DATA_2("handle=%x flags=%x", aHandle, aFlags); |
|
3165 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3166 label->setTextInteractionFlags( static_cast<Qt::TextInteractionFlags>(aFlags) ); |
|
3167 } |
|
3168 SWT_CATCH |
|
3169 } |
|
3170 |
|
3171 JNIEXPORT void JNICALL OS_NATIVE( QLabel_1setOpenExternalLinks ) |
|
3172 ( JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aBool ) |
|
3173 { |
|
3174 SWT_TRY |
|
3175 { |
|
3176 SWT_LOG_JNI_CALL(); |
|
3177 SWT_LOG_DATA_1("handle=%x ", aHandle); |
|
3178 HANDLE_TO_POINTER( QLabel*, label, aHandle ); |
|
3179 SWT_LOG_DATA_1( "call setOpenExternalLinks(true) %d", 0 ); |
|
3180 label->setOpenExternalLinks( aBool == JNI_TRUE ? true : false ); |
|
3181 } |
|
3182 SWT_CATCH |
|
3183 } |
|
3184 |
|
3185 // |
|
3186 // QMenu |
|
3187 // |
|
3188 |
|
3189 JNIEXPORT jint JNICALL OS_NATIVE( QMenu_1new ) |
|
3190 ( JNIEnv* aJniEnv , jclass, jint aParentHandle) |
|
3191 { |
|
3192 QMenu* menu = NULL; |
|
3193 SWT_TRY |
|
3194 { |
|
3195 SWT_LOG_JNI_CALL(); |
|
3196 SWT_LOG_DATA_1("parentHandle=%x", aParentHandle ); |
|
3197 HANDLE_TO_POINTER( QWidget*, parent, aParentHandle ); |
|
3198 menu = new QMenu( parent ); |
|
3199 } |
|
3200 SWT_CATCH |
|
3201 return POINTER_TO_HANDLE( menu ); |
|
3202 } |
|
3203 |
|
3204 JNIEXPORT void JNICALL OS_NATIVE( QMenu_1addAction ) |
|
3205 (JNIEnv* aJniEnv , jclass, jint aMenuHandle, jint aActionHandle ) |
|
3206 { |
|
3207 SWT_TRY |
|
3208 { |
|
3209 SWT_LOG_JNI_CALL(); |
|
3210 SWT_LOG_DATA_2("menuHandle=%x, actionHandle=%x", aMenuHandle, aActionHandle ); |
|
3211 HANDLE_TO_POINTER( QMenu*, menu, aMenuHandle ); |
|
3212 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
3213 menu->addAction( action ); |
|
3214 } |
|
3215 SWT_CATCH |
|
3216 } |
|
3217 JNIEXPORT jint JNICALL OS_NATIVE( QMenu_1exec ) |
|
3218 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aActionHandle ) |
|
3219 { |
|
3220 QAction* selectedAction= NULL; |
|
3221 SWT_TRY |
|
3222 { |
|
3223 SWT_LOG_JNI_CALL(); |
|
3224 SWT_LOG_DATA_4( "aHandle=%d x=%d y=%d aActionHandle=%d", aHandle, aX, aY, aActionHandle ); |
|
3225 HANDLE_TO_POINTER( QMenu*, menu, aHandle ); |
|
3226 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
3227 QPoint pos(aX,aY); |
|
3228 AutoPopExecStack stackExec(menu); |
|
3229 selectedAction = menu->exec( pos, action ); |
|
3230 } |
|
3231 SWT_CATCH |
|
3232 return POINTER_TO_HANDLE( selectedAction ); |
|
3233 } |
|
3234 |
|
3235 JNIEXPORT void JNICALL OS_NATIVE( QMenu_1setDefaultAction ) |
|
3236 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aActionHandle) |
|
3237 { |
|
3238 SWT_TRY |
|
3239 { |
|
3240 SWT_LOG_JNI_CALL(); |
|
3241 SWT_LOG_DATA_2("aHandle=%x, actionHandle=%x", aHandle, aActionHandle ); |
|
3242 HANDLE_TO_POINTER( QMenu*, menu, aHandle ); |
|
3243 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
3244 menu->setDefaultAction( action ); |
|
3245 } |
|
3246 SWT_CATCH |
|
3247 |
|
3248 } |
|
3249 |
|
3250 JNIEXPORT jint JNICALL OS_NATIVE ( QMenu_1defaultAction ) |
|
3251 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3252 { |
|
3253 QAction* action = NULL; |
|
3254 SWT_TRY |
|
3255 { |
|
3256 SWT_LOG_JNI_CALL(); |
|
3257 SWT_LOG_DATA_1("aHandle=%x", aHandle ); |
|
3258 HANDLE_TO_POINTER( QMenu*, menu, aHandle ); |
|
3259 action = menu->defaultAction(); |
|
3260 } |
|
3261 SWT_CATCH |
|
3262 return POINTER_TO_HANDLE( action ); |
|
3263 } |
|
3264 |
|
3265 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_OS_QMenu_1popup |
|
3266 (JNIEnv *aJniEnv, jclass, jint aHandle, jint aX, jint aY, jint aActionHandle) |
|
3267 { |
|
3268 SWT_TRY |
|
3269 { |
|
3270 SWT_LOG_JNI_CALL(); |
|
3271 SWT_LOG_DATA_4("aHandle=%x, aX=%d, aY=%d, aActionHandle=%x", aHandle, aX, aY, aActionHandle ); |
|
3272 HANDLE_TO_POINTER( QMenu*, menu, aHandle ); |
|
3273 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
3274 menu->popup(QPoint(aX, aY), action); |
|
3275 } |
|
3276 SWT_CATCH |
|
3277 } |
|
3278 |
|
3279 // |
|
3280 // QLineEdit |
|
3281 // |
|
3282 JNIEXPORT jint JNICALL OS_NATIVE(QLineEdit_1new) |
|
3283 (JNIEnv* aJniEnv , jclass) |
|
3284 { |
|
3285 QLineEdit* lineEdit = NULL; |
|
3286 SWT_TRY |
|
3287 { |
|
3288 SWT_LOG_JNI_CALL(); |
|
3289 lineEdit = new QLineEdit(); |
|
3290 } |
|
3291 SWT_CATCH |
|
3292 return POINTER_TO_HANDLE(lineEdit); |
|
3293 } |
|
3294 |
|
3295 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setText) |
|
3296 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
3297 { |
|
3298 SWT_TRY |
|
3299 { |
|
3300 SWT_LOG_JNI_CALL(); |
|
3301 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3302 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3303 lineEdit->setText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
3304 } |
|
3305 SWT_CATCH |
|
3306 } |
|
3307 |
|
3308 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1cut) |
|
3309 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3310 { |
|
3311 #ifndef QT_NO_CLIPBOARD |
|
3312 SWT_TRY |
|
3313 { |
|
3314 SWT_LOG_JNI_CALL(); |
|
3315 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3316 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3317 lineEdit->cut(); |
|
3318 } |
|
3319 SWT_CATCH |
|
3320 #endif |
|
3321 } |
|
3322 |
|
3323 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1copy) |
|
3324 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3325 { |
|
3326 #ifndef QT_NO_CLIPBOARD |
|
3327 SWT_TRY |
|
3328 { |
|
3329 SWT_LOG_JNI_CALL(); |
|
3330 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3331 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3332 lineEdit->copy(); |
|
3333 } |
|
3334 SWT_CATCH |
|
3335 #endif |
|
3336 } |
|
3337 |
|
3338 JNIEXPORT jstring JNICALL OS_NATIVE(QLineEdit_1text) |
|
3339 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3340 { |
|
3341 jstring javaString = NULL; |
|
3342 SWT_TRY |
|
3343 { |
|
3344 SWT_LOG_JNI_CALL(); |
|
3345 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3346 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3347 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, lineEdit->text()); |
|
3348 } |
|
3349 SWT_CATCH |
|
3350 return javaString; |
|
3351 } |
|
3352 |
|
3353 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1insert) |
|
3354 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
3355 { |
|
3356 SWT_TRY |
|
3357 { |
|
3358 SWT_LOG_JNI_CALL(); |
|
3359 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3360 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3361 lineEdit->insert(swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
3362 } |
|
3363 SWT_CATCH |
|
3364 } |
|
3365 |
|
3366 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setMaxLength) |
|
3367 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMaxLength) |
|
3368 { |
|
3369 SWT_TRY |
|
3370 { |
|
3371 SWT_LOG_JNI_CALL(); |
|
3372 SWT_LOG_DATA_2("handle=%x, maxLength=%d", aHandle, aMaxLength); |
|
3373 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3374 lineEdit->setMaxLength(aMaxLength); |
|
3375 } |
|
3376 SWT_CATCH |
|
3377 } |
|
3378 |
|
3379 JNIEXPORT jint JNICALL OS_NATIVE(QLineEdit_1maxLength) |
|
3380 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3381 { |
|
3382 jint maxLength = 0; |
|
3383 SWT_TRY |
|
3384 { |
|
3385 SWT_LOG_JNI_CALL(); |
|
3386 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3387 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3388 maxLength = lineEdit->maxLength(); |
|
3389 } |
|
3390 SWT_CATCH |
|
3391 return maxLength; |
|
3392 } |
|
3393 |
|
3394 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setSelection) |
|
3395 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStart, jint aLength) |
|
3396 { |
|
3397 SWT_TRY |
|
3398 { |
|
3399 SWT_LOG_JNI_CALL(); |
|
3400 SWT_LOG_DATA_3("handle=%x, start=%d, length=%d", aHandle, aStart, aLength); |
|
3401 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3402 lineEdit->setSelection(aStart, aLength); |
|
3403 } |
|
3404 SWT_CATCH |
|
3405 } |
|
3406 |
|
3407 JNIEXPORT jint JNICALL OS_NATIVE(QLineEdit_1cursorPosition) |
|
3408 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3409 { |
|
3410 jint cursorPosition = 0; |
|
3411 SWT_TRY |
|
3412 { |
|
3413 SWT_LOG_JNI_CALL(); |
|
3414 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3415 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3416 cursorPosition = lineEdit->cursorPosition(); |
|
3417 } |
|
3418 SWT_CATCH |
|
3419 return cursorPosition; |
|
3420 } |
|
3421 |
|
3422 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setCursorPosition) |
|
3423 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPosition) |
|
3424 { |
|
3425 SWT_TRY |
|
3426 { |
|
3427 SWT_LOG_JNI_CALL(); |
|
3428 SWT_LOG_DATA_2("handle=%x, position=%d", aHandle, aPosition); |
|
3429 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3430 lineEdit->setCursorPosition(aPosition); |
|
3431 } |
|
3432 SWT_CATCH |
|
3433 } |
|
3434 |
|
3435 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1deselect) |
|
3436 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3437 { |
|
3438 SWT_TRY |
|
3439 { |
|
3440 SWT_LOG_JNI_CALL(); |
|
3441 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3442 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3443 lineEdit->deselect(); |
|
3444 } |
|
3445 SWT_CATCH |
|
3446 } |
|
3447 |
|
3448 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1end) |
|
3449 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aMark) |
|
3450 { |
|
3451 SWT_TRY |
|
3452 { |
|
3453 SWT_LOG_JNI_CALL(); |
|
3454 SWT_LOG_DATA_2("handle=%x, mark=%d", aHandle, aMark); |
|
3455 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3456 lineEdit->end(aMark == JNI_TRUE ? true : false); |
|
3457 } |
|
3458 SWT_CATCH |
|
3459 } |
|
3460 |
|
3461 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setReadOnly) |
|
3462 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aReadOnly) |
|
3463 { |
|
3464 SWT_TRY |
|
3465 { |
|
3466 SWT_LOG_JNI_CALL(); |
|
3467 SWT_LOG_DATA_2("handle=%x, readOnly=%d", aHandle, aReadOnly); |
|
3468 HANDLE_TO_POINTER( QLineEdit*, lineEdit, aHandle ); |
|
3469 lineEdit->setReadOnly(aReadOnly == JNI_TRUE ? true : false); |
|
3470 } |
|
3471 SWT_CATCH |
|
3472 } |
|
3473 |
|
3474 JNIEXPORT jboolean JNICALL OS_NATIVE(QLineEdit_1isReadOnly) |
|
3475 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3476 { |
|
3477 jboolean readOnly = JNI_FALSE; |
|
3478 SWT_TRY |
|
3479 { |
|
3480 SWT_LOG_JNI_CALL(); |
|
3481 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3482 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3483 readOnly = lineEdit->isReadOnly() ? JNI_TRUE : JNI_FALSE; |
|
3484 } |
|
3485 SWT_CATCH |
|
3486 return readOnly; |
|
3487 } |
|
3488 |
|
3489 JNIEXPORT jstring JNICALL OS_NATIVE(QLineEdit_1selectedText) |
|
3490 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3491 { |
|
3492 jstring javaString = NULL; |
|
3493 SWT_TRY |
|
3494 { |
|
3495 SWT_LOG_JNI_CALL(); |
|
3496 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3497 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3498 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, lineEdit->selectedText()); |
|
3499 } |
|
3500 SWT_CATCH |
|
3501 return javaString; |
|
3502 } |
|
3503 |
|
3504 JNIEXPORT jint JNICALL OS_NATIVE(QLineEdit_1selectionStart) |
|
3505 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3506 { |
|
3507 jint selectionStart = 0; |
|
3508 SWT_TRY |
|
3509 { |
|
3510 SWT_LOG_JNI_CALL(); |
|
3511 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3512 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3513 selectionStart = lineEdit->selectionStart(); |
|
3514 } |
|
3515 SWT_CATCH |
|
3516 return selectionStart; |
|
3517 } |
|
3518 |
|
3519 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1selectAll) |
|
3520 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3521 { |
|
3522 SWT_TRY |
|
3523 { |
|
3524 SWT_LOG_JNI_CALL(); |
|
3525 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3526 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3527 lineEdit->selectAll(); |
|
3528 } |
|
3529 SWT_CATCH |
|
3530 } |
|
3531 |
|
3532 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setEchoMode) |
|
3533 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aEchoMode) |
|
3534 { |
|
3535 SWT_TRY |
|
3536 { |
|
3537 SWT_LOG_JNI_CALL(); |
|
3538 SWT_LOG_DATA_2("handle=%x, echoMode=%d", aHandle, aEchoMode); |
|
3539 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3540 lineEdit->setEchoMode(static_cast<QLineEdit::EchoMode>(aEchoMode)); |
|
3541 } |
|
3542 SWT_CATCH |
|
3543 } |
|
3544 |
|
3545 JNIEXPORT jint JNICALL OS_NATIVE(QLineEdit_1echoMode) |
|
3546 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3547 { |
|
3548 jint echoMode = 0; |
|
3549 SWT_TRY |
|
3550 { |
|
3551 SWT_LOG_JNI_CALL(); |
|
3552 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3553 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3554 echoMode = lineEdit->echoMode(); |
|
3555 } |
|
3556 SWT_CATCH |
|
3557 return echoMode; |
|
3558 } |
|
3559 |
|
3560 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setAlignment) |
|
3561 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlignment) |
|
3562 { |
|
3563 SWT_TRY |
|
3564 { |
|
3565 SWT_LOG_JNI_CALL(); |
|
3566 SWT_LOG_DATA_2("handle=%x, alignment=%d", aHandle, aAlignment); |
|
3567 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3568 lineEdit->setAlignment(static_cast<Qt::Alignment>(aAlignment)); |
|
3569 } |
|
3570 SWT_CATCH |
|
3571 } |
|
3572 |
|
3573 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setFrame) |
|
3574 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aShowFrame) |
|
3575 { |
|
3576 SWT_TRY |
|
3577 { |
|
3578 SWT_LOG_JNI_CALL(); |
|
3579 SWT_LOG_DATA_2("handle=%x, showFrame=%d", aHandle, aShowFrame); |
|
3580 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3581 lineEdit->setFrame(aShowFrame == JNI_TRUE ? true : false); |
|
3582 } |
|
3583 SWT_CATCH |
|
3584 } |
|
3585 |
|
3586 JNIEXPORT jint JNICALL OS_NATIVE(QLineEdit_1swt_1getBorderWidth) |
|
3587 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3588 { |
|
3589 int width = 0; |
|
3590 SWT_TRY |
|
3591 { |
|
3592 SWT_LOG_JNI_CALL(); |
|
3593 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3594 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3595 QStyle* style = lineEdit->style(); |
|
3596 if (style) |
|
3597 { |
|
3598 width = style->pixelMetric(QStyle::PM_DefaultFrameWidth); |
|
3599 } |
|
3600 } |
|
3601 SWT_CATCH |
|
3602 return width; |
|
3603 } |
|
3604 |
|
3605 JNIEXPORT void JNICALL OS_NATIVE(QLineEdit_1setValidator) |
|
3606 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValidatorHandle) |
|
3607 { |
|
3608 SWT_TRY |
|
3609 { |
|
3610 SWT_LOG_JNI_CALL(); |
|
3611 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aHandle); |
|
3612 HANDLE_TO_POINTER(QValidator*, validator, aValidatorHandle); |
|
3613 lineEdit->setValidator( validator ); |
|
3614 } |
|
3615 SWT_CATCH |
|
3616 } |
|
3617 |
|
3618 JNIEXPORT jobject JNICALL OS_NATIVE(QLineEdit_1swt_1preferredClientSize) |
|
3619 (JNIEnv* aJniEnv , jclass, jint aLineEditHandle) |
|
3620 { |
|
3621 jobject size = NULL; |
|
3622 SWT_TRY |
|
3623 { |
|
3624 SWT_LOG_JNI_CALL(); |
|
3625 SWT_LOG_DATA_1("handle=%x", aLineEditHandle); |
|
3626 HANDLE_TO_POINTER(QLineEdit*, lineEdit, aLineEditHandle); |
|
3627 |
|
3628 QFontMetrics fm(lineEdit->font()); |
|
3629 int left, top, right, bottom; |
|
3630 lineEdit->getContentsMargins(&left, &top, &right, &bottom); |
|
3631 int h = qMax(fm.lineSpacing(), QLineEdit_minimumLineSpacing) + 2*QLineEdit_verticalMargin |
|
3632 + top + bottom; |
|
3633 int w = fm.width(lineEdit->text()) + 2*QLineEdit_horizontalMargin |
|
3634 + left + right; |
|
3635 QPoint point(w, h); |
|
3636 size = swtApp->jniUtils().NewJavaPoint( aJniEnv, point ); |
|
3637 } |
|
3638 SWT_CATCH |
|
3639 return size; |
|
3640 } |
|
3641 |
|
3642 // |
|
3643 // QTextEdit |
|
3644 // |
|
3645 |
|
3646 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1new) |
|
3647 (JNIEnv* aJniEnv , jclass) |
|
3648 { |
|
3649 QTextEdit* textEdit = NULL; |
|
3650 SWT_TRY |
|
3651 { |
|
3652 SWT_LOG_JNI_CALL(); |
|
3653 textEdit = new QTextEdit(); |
|
3654 } |
|
3655 SWT_CATCH |
|
3656 return POINTER_TO_HANDLE(textEdit); |
|
3657 } |
|
3658 |
|
3659 JNIEXPORT jstring JNICALL OS_NATIVE(QTextEdit_1toPlainText) |
|
3660 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3661 { |
|
3662 jstring javaString = NULL; |
|
3663 SWT_TRY |
|
3664 { |
|
3665 SWT_LOG_JNI_CALL(); |
|
3666 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3667 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3668 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, textEdit->toPlainText()); |
|
3669 } |
|
3670 SWT_CATCH |
|
3671 return javaString; |
|
3672 } |
|
3673 |
|
3674 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1setPlainText) |
|
3675 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
3676 { |
|
3677 SWT_TRY |
|
3678 { |
|
3679 SWT_LOG_JNI_CALL(); |
|
3680 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3681 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3682 textEdit->setPlainText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
3683 } |
|
3684 SWT_CATCH |
|
3685 } |
|
3686 |
|
3687 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1setHtml) |
|
3688 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aHtml) |
|
3689 { |
|
3690 SWT_TRY |
|
3691 { |
|
3692 SWT_LOG_JNI_CALL(); |
|
3693 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3694 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3695 textEdit->setHtml(swtApp->jniUtils().JavaStringToQString(aJniEnv, aHtml)); |
|
3696 } |
|
3697 SWT_CATCH |
|
3698 } |
|
3699 |
|
3700 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1insertPlainText) |
|
3701 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
3702 { |
|
3703 SWT_TRY |
|
3704 { |
|
3705 SWT_LOG_JNI_CALL(); |
|
3706 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3707 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3708 textEdit->insertPlainText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
3709 } |
|
3710 SWT_CATCH |
|
3711 } |
|
3712 |
|
3713 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1cut) |
|
3714 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3715 { |
|
3716 #ifndef QT_NO_CLIPBOARD |
|
3717 SWT_TRY |
|
3718 { |
|
3719 SWT_LOG_JNI_CALL(); |
|
3720 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3721 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3722 textEdit->cut(); |
|
3723 } |
|
3724 SWT_CATCH |
|
3725 #endif |
|
3726 } |
|
3727 |
|
3728 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1copy) |
|
3729 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3730 { |
|
3731 #ifndef QT_NO_CLIPBOARD |
|
3732 SWT_TRY |
|
3733 { |
|
3734 SWT_LOG_JNI_CALL(); |
|
3735 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3736 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3737 textEdit->copy(); |
|
3738 } |
|
3739 SWT_CATCH |
|
3740 #endif |
|
3741 } |
|
3742 |
|
3743 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1setReadOnly) |
|
3744 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aReadOnly) |
|
3745 { |
|
3746 SWT_TRY |
|
3747 { |
|
3748 SWT_LOG_JNI_CALL(); |
|
3749 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3750 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3751 textEdit->setReadOnly(aReadOnly == JNI_TRUE ? true : false); |
|
3752 } |
|
3753 SWT_CATCH |
|
3754 } |
|
3755 |
|
3756 JNIEXPORT jboolean JNICALL OS_NATIVE(QTextEdit_1isReadOnly) |
|
3757 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3758 { |
|
3759 jboolean readOnly = JNI_FALSE; |
|
3760 SWT_TRY |
|
3761 { |
|
3762 SWT_LOG_JNI_CALL(); |
|
3763 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3764 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3765 readOnly = textEdit->isReadOnly() ? JNI_TRUE : JNI_FALSE; |
|
3766 } |
|
3767 SWT_CATCH |
|
3768 return readOnly; |
|
3769 } |
|
3770 |
|
3771 JNIEXPORT jobject JNICALL OS_NATIVE(QTextEdit_1cursorRect) |
|
3772 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3773 { |
|
3774 jobject javaRectangle = NULL; |
|
3775 SWT_TRY |
|
3776 { |
|
3777 SWT_LOG_JNI_CALL(); |
|
3778 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3779 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3780 javaRectangle = swtApp->jniUtils().NewJavaRectangle(aJniEnv, textEdit->cursorRect()); |
|
3781 } |
|
3782 SWT_CATCH |
|
3783 return javaRectangle; |
|
3784 } |
|
3785 |
|
3786 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1ensureCursorVisible) |
|
3787 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
3788 { |
|
3789 SWT_TRY |
|
3790 { |
|
3791 SWT_LOG_JNI_CALL(); |
|
3792 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
3793 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3794 textEdit->ensureCursorVisible(); |
|
3795 } |
|
3796 SWT_CATCH |
|
3797 } |
|
3798 |
|
3799 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1setAlignment) |
|
3800 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlignment) |
|
3801 { |
|
3802 SWT_TRY |
|
3803 { |
|
3804 SWT_LOG_JNI_CALL(); |
|
3805 SWT_LOG_DATA_2("handle=%x, alignment=%d", aHandle, aAlignment); |
|
3806 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3807 textEdit->setAlignment(static_cast<Qt::Alignment>(aAlignment)); |
|
3808 } |
|
3809 SWT_CATCH |
|
3810 } |
|
3811 |
|
3812 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1setLineWrapMode) |
|
3813 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWrapMode) |
|
3814 { |
|
3815 SWT_TRY |
|
3816 { |
|
3817 SWT_LOG_JNI_CALL(); |
|
3818 SWT_LOG_DATA_2("handle=%x, wrapMode=%d", aHandle, aWrapMode); |
|
3819 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
3820 textEdit->setLineWrapMode(static_cast<QTextEdit::LineWrapMode>(aWrapMode)); |
|
3821 } |
|
3822 SWT_CATCH |
|
3823 } |
|
3824 |
|
3825 // |
|
3826 // QTextEdit_swt |
|
3827 // |
|
3828 static jint getNumberOfPrecedingTextLines(const QTextBlock& aTextBlock) |
|
3829 { |
|
3830 QTextBlock block(aTextBlock.previous()); |
|
3831 jint lineCount = 0; |
|
3832 while (block.isValid()) |
|
3833 { |
|
3834 QTextLayout* textLayout = block.layout(); |
|
3835 if (textLayout) |
|
3836 { |
|
3837 // if block is valid, there is at least 1 line |
|
3838 // even if layout would return 0 |
|
3839 int lines = textLayout->lineCount(); |
|
3840 lineCount += (lines> 0) ? lines : 1; |
|
3841 } |
|
3842 block = block.previous(); |
|
3843 } |
|
3844 return lineCount; |
|
3845 } |
|
3846 |
|
3847 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1getCaretPosition) |
|
3848 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
3849 { |
|
3850 jint position = 0; |
|
3851 SWT_TRY |
|
3852 { |
|
3853 SWT_LOG_JNI_CALL(); |
|
3854 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
3855 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
3856 position = textEdit->textCursor().position(); |
|
3857 } |
|
3858 SWT_CATCH |
|
3859 return position; |
|
3860 } |
|
3861 |
|
3862 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1swt_1clearSelection) |
|
3863 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
3864 { |
|
3865 SWT_TRY |
|
3866 { |
|
3867 SWT_LOG_JNI_CALL(); |
|
3868 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
3869 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
3870 QTextCursor textCursor(textEdit->textCursor()); |
|
3871 textCursor.clearSelection(); |
|
3872 textEdit->setTextCursor(textCursor); |
|
3873 } |
|
3874 SWT_CATCH |
|
3875 } |
|
3876 |
|
3877 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1getCaretLineNumber) |
|
3878 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
3879 { |
|
3880 jint lineNumber = 0; |
|
3881 SWT_TRY |
|
3882 { |
|
3883 SWT_LOG_JNI_CALL(); |
|
3884 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
3885 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
3886 |
|
3887 QTextCursor textCursor = textEdit->textCursor(); |
|
3888 QTextBlock textBlock = textCursor.block(); |
|
3889 QTextLayout* textLayout = textBlock.layout(); |
|
3890 |
|
3891 if (textLayout) |
|
3892 { |
|
3893 // lineNumber() returns the line number in the text block |
|
3894 lineNumber = textLayout->lineForTextPosition( |
|
3895 textCursor.position() - textBlock.position()).lineNumber(); |
|
3896 } |
|
3897 |
|
3898 lineNumber += getNumberOfPrecedingTextLines(textBlock); |
|
3899 } |
|
3900 SWT_CATCH |
|
3901 return lineNumber; |
|
3902 } |
|
3903 |
|
3904 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1getLineHeight) |
|
3905 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
3906 { |
|
3907 jint lineHeight = 0; |
|
3908 SWT_TRY |
|
3909 { |
|
3910 SWT_LOG_JNI_CALL(); |
|
3911 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
3912 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
3913 |
|
3914 QTextLayout* textLayout = textEdit->textCursor().block().layout(); |
|
3915 |
|
3916 if (textLayout) |
|
3917 { |
|
3918 lineHeight = qRound(textLayout->lineAt(0).height()); |
|
3919 } |
|
3920 } |
|
3921 SWT_CATCH |
|
3922 return lineHeight; |
|
3923 } |
|
3924 |
|
3925 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1swt_1setTopIndex) |
|
3926 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle, jint aLine) |
|
3927 { |
|
3928 SWT_TRY |
|
3929 { |
|
3930 SWT_LOG_JNI_CALL(); |
|
3931 SWT_LOG_DATA_2("handle=%x, line=%d", aTextEditHandle, aLine); |
|
3932 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
3933 |
|
3934 QScrollBar* scrollBar = textEdit->verticalScrollBar(); |
|
3935 QTextDocument* textDocument = textEdit->document(); |
|
3936 if (scrollBar && textDocument) |
|
3937 { |
|
3938 if (aLine == 0) |
|
3939 { |
|
3940 scrollBar->setValue(0); |
|
3941 } |
|
3942 else |
|
3943 { |
|
3944 QTextBlock textBlock(textDocument->begin()); |
|
3945 int lineCount = 0; |
|
3946 |
|
3947 // Loop through the text blocks in the text document and check |
|
3948 // which block contains the desired line. Then get the y-position of |
|
3949 // the line and scroll the textEdit content accordingly. |
|
3950 while(textBlock.isValid()) |
|
3951 { |
|
3952 QTextLayout* layout = textBlock.layout(); |
|
3953 if (layout) |
|
3954 { |
|
3955 int oldLineCount = lineCount; |
|
3956 int lines = layout->lineCount(); |
|
3957 // if block is valid, there is at least 1 line |
|
3958 // even if layout would return 0 |
|
3959 lineCount += (lines> 0) ? lines : 1; |
|
3960 |
|
3961 if (aLine < lineCount) |
|
3962 { |
|
3963 int linePosition = qRound(layout->position().y() + |
|
3964 layout->lineAt(aLine - oldLineCount).y()); |
|
3965 scrollBar->setValue(linePosition); |
|
3966 break; |
|
3967 } |
|
3968 } |
|
3969 textBlock = textBlock.next(); |
|
3970 } |
|
3971 } |
|
3972 } |
|
3973 } |
|
3974 SWT_CATCH |
|
3975 } |
|
3976 |
|
3977 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1getTopIndex) |
|
3978 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
3979 { |
|
3980 jint lineIndex = 0; |
|
3981 SWT_TRY |
|
3982 { |
|
3983 SWT_LOG_JNI_CALL(); |
|
3984 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
3985 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
3986 |
|
3987 QScrollBar* scrollBar = textEdit->verticalScrollBar(); |
|
3988 |
|
3989 if (scrollBar) |
|
3990 { |
|
3991 // First get the text block that at the top of visible viewport |
|
3992 int top = scrollBar->value(); |
|
3993 |
|
3994 QTextCursor textCursor(textEdit->cursorForPosition(QPoint(0, 0))); |
|
3995 QTextBlock topBlock(textCursor.block()); |
|
3996 QTextLayout* layout = topBlock.layout(); |
|
3997 |
|
3998 // Find out how many lines of the "top block" are above the visible area. |
|
3999 if (layout && layout->position().y() < top) |
|
4000 { |
|
4001 int layoutPos = qRound(layout->position().y()); |
|
4002 |
|
4003 // If less than half of the line height is visible, return next line |
|
4004 for (int i = 0; i < layout->lineCount() && |
|
4005 (layoutPos + layout->lineAt(i).rect().bottom()) <= |
|
4006 (top + layout->lineAt(i).rect().height() / 2); ++i) |
|
4007 { |
|
4008 ++lineIndex; |
|
4009 } |
|
4010 } |
|
4011 |
|
4012 lineIndex += getNumberOfPrecedingTextLines(topBlock); |
|
4013 } |
|
4014 } |
|
4015 SWT_CATCH |
|
4016 return lineIndex; |
|
4017 } |
|
4018 |
|
4019 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1getLineCount) |
|
4020 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
4021 { |
|
4022 jint lineCount = 0; |
|
4023 SWT_TRY |
|
4024 { |
|
4025 SWT_LOG_JNI_CALL(); |
|
4026 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
4027 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
4028 QTextDocument* textDocument = textEdit->document(); |
|
4029 |
|
4030 if (textDocument) |
|
4031 { |
|
4032 lineCount = getNumberOfPrecedingTextLines(textDocument->end()); |
|
4033 } |
|
4034 } |
|
4035 SWT_CATCH |
|
4036 return lineCount; |
|
4037 } |
|
4038 |
|
4039 JNIEXPORT jstring JNICALL OS_NATIVE(QTextEdit_1swt_1getSelectionText) |
|
4040 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
4041 { |
|
4042 jstring javaString = NULL; |
|
4043 SWT_TRY |
|
4044 { |
|
4045 SWT_LOG_JNI_CALL(); |
|
4046 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
4047 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
4048 QString string = textEdit->textCursor().selectedText(); |
|
4049 string.replace(KParagraphSeparator, "\n"); |
|
4050 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, string); |
|
4051 } |
|
4052 SWT_CATCH |
|
4053 return javaString; |
|
4054 } |
|
4055 |
|
4056 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1selectionStart) |
|
4057 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
4058 { |
|
4059 jint selectionStart = 0; |
|
4060 SWT_TRY |
|
4061 { |
|
4062 SWT_LOG_JNI_CALL(); |
|
4063 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
4064 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
4065 selectionStart = textEdit->textCursor().selectionStart(); |
|
4066 } |
|
4067 SWT_CATCH |
|
4068 return selectionStart; |
|
4069 } |
|
4070 |
|
4071 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1selectionEnd) |
|
4072 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle) |
|
4073 { |
|
4074 jint selectionEnd = 0; |
|
4075 SWT_TRY |
|
4076 { |
|
4077 SWT_LOG_JNI_CALL(); |
|
4078 SWT_LOG_DATA_1("handle=%x", aTextEditHandle); |
|
4079 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
4080 selectionEnd = textEdit->textCursor().selectionEnd(); |
|
4081 } |
|
4082 SWT_CATCH |
|
4083 return selectionEnd; |
|
4084 } |
|
4085 |
|
4086 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1swt_1setCursorPosition) |
|
4087 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPosition, jboolean aMoveAnchor) |
|
4088 { |
|
4089 SWT_TRY |
|
4090 { |
|
4091 SWT_LOG_JNI_CALL(); |
|
4092 SWT_LOG_DATA_3("handle=%x, position=%x, moveAnchor=%x", aHandle, aPosition, aMoveAnchor); |
|
4093 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
4094 QTextCursor textCursor(textEdit->textCursor()); |
|
4095 textCursor.setPosition(aPosition, aMoveAnchor ? QTextCursor::MoveAnchor : QTextCursor::KeepAnchor); |
|
4096 textEdit->setTextCursor(textCursor); |
|
4097 } |
|
4098 SWT_CATCH |
|
4099 } |
|
4100 |
|
4101 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1swt_1selectAll) |
|
4102 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
4103 { |
|
4104 SWT_TRY |
|
4105 { |
|
4106 SWT_LOG_JNI_CALL(); |
|
4107 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4108 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
4109 QTextCursor textCursor(textEdit->textCursor()); |
|
4110 textCursor.select(QTextCursor::Document); |
|
4111 textEdit->setTextCursor(textCursor); |
|
4112 } |
|
4113 SWT_CATCH |
|
4114 } |
|
4115 |
|
4116 JNIEXPORT jint JNICALL OS_NATIVE(QTextEdit_1swt_1getCharCount) |
|
4117 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
4118 { |
|
4119 jint length = 0; |
|
4120 SWT_TRY |
|
4121 { |
|
4122 SWT_LOG_JNI_CALL(); |
|
4123 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4124 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
4125 QTextCursor textCursor(textEdit->textCursor()); |
|
4126 textCursor.movePosition(QTextCursor::End); |
|
4127 length = textCursor.position(); |
|
4128 } |
|
4129 SWT_CATCH |
|
4130 return length; |
|
4131 } |
|
4132 |
|
4133 JNIEXPORT void JNICALL OS_NATIVE(QTextEdit_1swt_1append) |
|
4134 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
4135 { |
|
4136 SWT_TRY |
|
4137 { |
|
4138 SWT_LOG_JNI_CALL(); |
|
4139 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4140 HANDLE_TO_POINTER(QTextEdit*, textEdit, aHandle); |
|
4141 QTextCursor textCursor(textEdit->textCursor()); |
|
4142 textCursor.movePosition(QTextCursor::End); |
|
4143 textCursor.insertText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
4144 textEdit->setTextCursor(textCursor); |
|
4145 } |
|
4146 SWT_CATCH |
|
4147 } |
|
4148 |
|
4149 JNIEXPORT jobject JNICALL OS_NATIVE(QTextEdit_1swt_1preferredClientSize) |
|
4150 (JNIEnv* aJniEnv , jclass, jint aTextEditHandle, jint aWHint) |
|
4151 { |
|
4152 jobject size = NULL; |
|
4153 SWT_TRY |
|
4154 { |
|
4155 SWT_LOG_JNI_CALL(); |
|
4156 SWT_LOG_DATA_2("handle=%x width=%x", aTextEditHandle, aWHint); |
|
4157 HANDLE_TO_POINTER(QTextEdit*, textEdit, aTextEditHandle); |
|
4158 QTextDocument* doc = textEdit->document(); |
|
4159 if( doc ) |
|
4160 { |
|
4161 const qreal oldTextWidth = doc->textWidth(); |
|
4162 if (aWHint >= 0) |
|
4163 { |
|
4164 doc->setTextWidth(aWHint); |
|
4165 } |
|
4166 else |
|
4167 { |
|
4168 doc->adjustSize(); |
|
4169 } |
|
4170 QSize preferredSize= doc->size().toSize(); |
|
4171 doc->setTextWidth(oldTextWidth); |
|
4172 QPoint point(preferredSize.width(), preferredSize.height()); |
|
4173 size = swtApp->jniUtils().NewJavaPoint( aJniEnv, point ); |
|
4174 } |
|
4175 } |
|
4176 SWT_CATCH |
|
4177 return size; |
|
4178 } |
|
4179 |
|
4180 |
|
4181 // |
|
4182 // QValidator |
|
4183 // |
|
4184 JNIEXPORT jint JNICALL OS_NATIVE( QRegExpValidator_1new ) |
|
4185 ( JNIEnv* aJniEnv , jclass, jint aParentHandle, jstring aRegExp ) |
|
4186 { |
|
4187 QRegExpValidator* validator = NULL; |
|
4188 SWT_TRY |
|
4189 { |
|
4190 SWT_LOG_JNI_CALL(); |
|
4191 HANDLE_TO_POINTER( QObject*, parent, aParentHandle ); |
|
4192 validator = new QRegExpValidator( |
|
4193 QRegExp( swtApp->jniUtils().JavaStringToQString( aJniEnv, aRegExp ) ), parent ); |
|
4194 } |
|
4195 SWT_CATCH |
|
4196 return POINTER_TO_HANDLE( validator ); |
|
4197 } |
|
4198 |
|
4199 JNIEXPORT jboolean JNICALL OS_NATIVE( QValidator_1validate ) |
|
4200 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString ) |
|
4201 { |
|
4202 jboolean res = true; // Intentionally validating null and empty strings |
|
4203 SWT_TRY |
|
4204 { |
|
4205 SWT_LOG_JNI_CALL(); |
|
4206 HANDLE_TO_POINTER( QValidator*, validator, aHandle ); |
|
4207 if ( aString != NULL ) |
|
4208 { |
|
4209 QString str = swtApp->jniUtils().JavaStringToQString( aJniEnv, aString ); |
|
4210 if (str.length() > 0) |
|
4211 { |
|
4212 int start = 0; |
|
4213 res = validator->validate( str, start ) == QValidator::Acceptable; |
|
4214 } |
|
4215 } |
|
4216 } |
|
4217 SWT_CATCH |
|
4218 return res; |
|
4219 } |
|
4220 |
|
4221 // |
|
4222 // QMenuBar |
|
4223 // |
|
4224 JNIEXPORT jint JNICALL OS_NATIVE( QMenuBar_1new ) |
|
4225 ( JNIEnv* aJniEnv , jclass, jint aParentHandle ) |
|
4226 { |
|
4227 QMenuBar* menubar = NULL; |
|
4228 SWT_TRY |
|
4229 { |
|
4230 SWT_LOG_JNI_CALL(); |
|
4231 SWT_LOG_DATA_1("parentHandle=%x", aParentHandle ); |
|
4232 HANDLE_TO_POINTER( QWidget*, parent, aParentHandle ); |
|
4233 menubar = new QMenuBar(parent); |
|
4234 } |
|
4235 SWT_CATCH |
|
4236 return POINTER_TO_HANDLE( menubar ); |
|
4237 } |
|
4238 |
|
4239 JNIEXPORT void JNICALL OS_NATIVE( QMenuBar_1addAction ) |
|
4240 (JNIEnv* aJniEnv , jclass, jint aMenuBarHandle, jint aActionHandle) |
|
4241 { |
|
4242 SWT_TRY |
|
4243 { |
|
4244 SWT_LOG_JNI_CALL(); |
|
4245 SWT_LOG_DATA_2("menuBarHandle=%x, menuHandle=%x", aMenuBarHandle, aActionHandle ); |
|
4246 HANDLE_TO_POINTER( QMenuBar*, menuBar, aMenuBarHandle ); |
|
4247 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
4248 menuBar->addAction( action ); |
|
4249 } |
|
4250 SWT_CATCH |
|
4251 } |
|
4252 |
|
4253 // |
|
4254 // QAction |
|
4255 // |
|
4256 JNIEXPORT jint JNICALL OS_NATIVE( QAction_1new ) |
|
4257 (JNIEnv* aJniEnv , jclass, jint aParentHandle ) |
|
4258 { |
|
4259 QAction* action = NULL; |
|
4260 SWT_TRY |
|
4261 { |
|
4262 SWT_LOG_JNI_CALL(); |
|
4263 HANDLE_TO_POINTER( QObject*, parent, aParentHandle ); |
|
4264 action = new QAction( parent ); |
|
4265 } |
|
4266 SWT_CATCH |
|
4267 return POINTER_TO_HANDLE( action ); |
|
4268 } |
|
4269 |
|
4270 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setSeparator ) |
|
4271 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aBool) |
|
4272 { |
|
4273 SWT_TRY |
|
4274 { |
|
4275 SWT_LOG_JNI_CALL(); |
|
4276 SWT_LOG_DATA_2("handle=%x, bool=%x", aHandle, aBool ); |
|
4277 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4278 action->setSeparator( aBool ); |
|
4279 } |
|
4280 SWT_CATCH |
|
4281 } |
|
4282 |
|
4283 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setCheckable ) |
|
4284 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aBool ) |
|
4285 { |
|
4286 SWT_TRY |
|
4287 { |
|
4288 SWT_LOG_JNI_CALL(); |
|
4289 SWT_LOG_DATA_2("handle=%x, bool=%x", aHandle, aBool ); |
|
4290 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4291 action->setCheckable( aBool ); |
|
4292 } |
|
4293 SWT_CATCH |
|
4294 } |
|
4295 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setText ) |
|
4296 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
4297 { |
|
4298 SWT_TRY |
|
4299 { |
|
4300 SWT_LOG_JNI_CALL(); |
|
4301 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4302 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4303 action->setText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
4304 } |
|
4305 SWT_CATCH |
|
4306 } |
|
4307 |
|
4308 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setMenu ) |
|
4309 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMenuHandle ) |
|
4310 { |
|
4311 SWT_TRY |
|
4312 { |
|
4313 SWT_LOG_JNI_CALL(); |
|
4314 SWT_LOG_DATA_2("aHandle=%x, aMenuHandle=%x", aHandle, aMenuHandle ); |
|
4315 HANDLE_TO_POINTER( QMenu*, menu, aMenuHandle ); |
|
4316 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4317 action->setMenu( menu ); |
|
4318 } |
|
4319 SWT_CATCH |
|
4320 } |
|
4321 |
|
4322 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setShortcut ) |
|
4323 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aKeySequenceHandle ) |
|
4324 { |
|
4325 SWT_TRY |
|
4326 { |
|
4327 SWT_LOG_JNI_CALL(); |
|
4328 SWT_LOG_DATA_2("aHandle=%x, aKeySequenceHandle=%x", aHandle, aKeySequenceHandle ); |
|
4329 QKeySequence* shortcut = reinterpret_cast<QKeySequence*>( aKeySequenceHandle ); |
|
4330 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4331 action->setShortcut( *shortcut ); |
|
4332 } |
|
4333 SWT_CATCH |
|
4334 } |
|
4335 |
|
4336 JNIEXPORT void JNICALL OS_NATIVE ( QAction_1setEnabled ) |
|
4337 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEnabled ) |
|
4338 { |
|
4339 SWT_TRY |
|
4340 { |
|
4341 SWT_LOG_JNI_CALL(); |
|
4342 SWT_LOG_DATA_2("handle=%x, aEnabled=%x", aHandle, aEnabled ); |
|
4343 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4344 action->setEnabled( aEnabled ); |
|
4345 } |
|
4346 SWT_CATCH |
|
4347 } |
|
4348 |
|
4349 JNIEXPORT jboolean JNICALL OS_NATIVE( QAction_1isEnabled ) |
|
4350 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
4351 { |
|
4352 jboolean enabled = JNI_TRUE; |
|
4353 SWT_TRY |
|
4354 { |
|
4355 SWT_LOG_JNI_CALL(); |
|
4356 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
4357 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4358 enabled = action->isEnabled( ); |
|
4359 } |
|
4360 SWT_CATCH |
|
4361 return enabled; |
|
4362 } |
|
4363 |
|
4364 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setChecked ) |
|
4365 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aChecked ) |
|
4366 { |
|
4367 SWT_TRY |
|
4368 { |
|
4369 SWT_LOG_JNI_CALL(); |
|
4370 SWT_LOG_DATA_2("handle=%x, aEnabled=%x", aHandle, aChecked ); |
|
4371 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4372 action->setChecked( aChecked ); |
|
4373 } |
|
4374 SWT_CATCH |
|
4375 } |
|
4376 |
|
4377 JNIEXPORT jboolean JNICALL OS_NATIVE( QAction_1isChecked ) |
|
4378 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
4379 { |
|
4380 jboolean checked = JNI_FALSE; |
|
4381 SWT_TRY |
|
4382 { |
|
4383 SWT_LOG_JNI_CALL(); |
|
4384 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
4385 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4386 checked = action->isChecked( ); |
|
4387 } |
|
4388 SWT_CATCH |
|
4389 return checked; |
|
4390 } |
|
4391 |
|
4392 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setIcon ) |
|
4393 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIconHandle ) |
|
4394 { |
|
4395 SWT_TRY |
|
4396 { |
|
4397 SWT_LOG_JNI_CALL(); |
|
4398 SWT_LOG_DATA_2("handle=%x, aIconHandle=%x", aHandle, aIconHandle ); |
|
4399 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4400 QIcon* icon = reinterpret_cast<QIcon*>(aIconHandle); |
|
4401 action->setIcon( *icon ); |
|
4402 } |
|
4403 SWT_CATCH |
|
4404 } |
|
4405 |
|
4406 JNIEXPORT void JNICALL OS_NATIVE( QAction_1setIconText ) |
|
4407 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
4408 { |
|
4409 SWT_TRY |
|
4410 { |
|
4411 SWT_LOG_JNI_CALL(); |
|
4412 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4413 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4414 action->setIconText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
4415 } |
|
4416 SWT_CATCH |
|
4417 } |
|
4418 |
|
4419 JNIEXPORT void JNICALL OS_NATIVE ( QAction_1setSoftKeyRole ) |
|
4420 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aRole ) |
|
4421 { |
|
4422 #if QT_VERSION >= 0x040600 |
|
4423 SWT_TRY |
|
4424 { |
|
4425 SWT_LOG_JNI_CALL(); |
|
4426 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4427 HANDLE_TO_POINTER( QAction*, action, aHandle ); |
|
4428 action->setSoftKeyRole( static_cast<QAction::SoftKeyRole>(aRole) ); |
|
4429 } |
|
4430 SWT_CATCH |
|
4431 #endif |
|
4432 } |
|
4433 |
|
4434 // |
|
4435 // QActionGroup |
|
4436 // |
|
4437 |
|
4438 JNIEXPORT jint JNICALL OS_NATIVE( QActionGroup_1new ) |
|
4439 ( JNIEnv* aJniEnv , jclass, jint aParentHandle ) |
|
4440 { |
|
4441 QActionGroup* actionGroup = NULL; |
|
4442 SWT_TRY |
|
4443 { |
|
4444 SWT_LOG_JNI_CALL(); |
|
4445 HANDLE_TO_POINTER( QObject*, parent, aParentHandle ); |
|
4446 actionGroup = new QActionGroup( parent ); |
|
4447 } |
|
4448 SWT_CATCH |
|
4449 return POINTER_TO_HANDLE( actionGroup ); |
|
4450 } |
|
4451 |
|
4452 |
|
4453 JNIEXPORT void JNICALL OS_NATIVE( QActionGroup_1setExclusive ) |
|
4454 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aExclusive ) |
|
4455 { |
|
4456 SWT_TRY |
|
4457 { |
|
4458 SWT_LOG_JNI_CALL(); |
|
4459 SWT_LOG_DATA_2("handle=%x, bool=%x", aHandle, aExclusive ); |
|
4460 HANDLE_TO_POINTER( QActionGroup*, actionGroup, aHandle ); |
|
4461 actionGroup->setExclusive( aExclusive ); |
|
4462 } |
|
4463 SWT_CATCH |
|
4464 } |
|
4465 |
|
4466 JNIEXPORT void JNICALL OS_NATIVE( QActionGroup_1addAction ) |
|
4467 ( JNIEnv* aJniEnv , jclass, jint aActionGroupHandle, jint aActionHandle ) |
|
4468 { |
|
4469 SWT_TRY |
|
4470 { |
|
4471 SWT_LOG_JNI_CALL(); |
|
4472 SWT_LOG_DATA_2("actionGroupHandle=%x, actionHandle=%x", aActionGroupHandle, aActionHandle ); |
|
4473 HANDLE_TO_POINTER( QActionGroup*, actionGroup, aActionGroupHandle ); |
|
4474 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
4475 actionGroup->addAction( action ); |
|
4476 } |
|
4477 SWT_CATCH |
|
4478 } |
|
4479 |
|
4480 JNIEXPORT void JNICALL OS_NATIVE( QActionGroup_1removeAction ) |
|
4481 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aActionHandle ) |
|
4482 { |
|
4483 SWT_TRY |
|
4484 { |
|
4485 SWT_LOG_JNI_CALL(); |
|
4486 SWT_LOG_DATA_2("actionGroupHandle=%x, actionHandle=%x", aHandle, aActionHandle ); |
|
4487 HANDLE_TO_POINTER( QActionGroup*, actionGroup, aHandle ); |
|
4488 HANDLE_TO_POINTER( QAction*, action, aActionHandle ); |
|
4489 actionGroup->removeAction( action ); |
|
4490 } |
|
4491 SWT_CATCH |
|
4492 } |
|
4493 |
|
4494 // |
|
4495 // QPixmap |
|
4496 // |
|
4497 |
|
4498 JNIEXPORT jboolean JNICALL OS_NATIVE( QPixmap_1load ) |
|
4499 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFileName ) |
|
4500 { |
|
4501 jboolean result = JNI_FALSE; |
|
4502 SWT_TRY |
|
4503 { |
|
4504 SWT_LOG_JNI_CALL(); |
|
4505 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4506 QPixmap* pixmap = static_cast< QPixmap* >( reinterpret_cast< QPaintDevice* >( aHandle ) ); |
|
4507 result = pixmap->load( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFileName ) ) == true ? JNI_TRUE : JNI_FALSE ; |
|
4508 } |
|
4509 SWT_CATCH |
|
4510 return result; |
|
4511 } |
|
4512 |
|
4513 |
|
4514 JNIEXPORT jint JNICALL JNICALL OS_NATIVE( QPixmap_1new ) |
|
4515 ( JNIEnv* aJniEnv , jclass) |
|
4516 { |
|
4517 QPixmap* pixmap = NULL; |
|
4518 SWT_TRY |
|
4519 { |
|
4520 SWT_LOG_JNI_CALL(); |
|
4521 pixmap = new QPixmap(); |
|
4522 } |
|
4523 SWT_CATCH |
|
4524 return reinterpret_cast< jint >( static_cast< QPaintDevice* >( pixmap ) ); |
|
4525 } |
|
4526 |
|
4527 JNIEXPORT void JNICALL OS_NATIVE( QPixmap_1delete ) |
|
4528 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
4529 { |
|
4530 SWT_TRY |
|
4531 { |
|
4532 SWT_LOG_JNI_CALL(); |
|
4533 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4534 QPixmap* pixmap = reinterpret_cast< QPixmap* >( aHandle ); |
|
4535 delete pixmap; |
|
4536 } |
|
4537 SWT_CATCH |
|
4538 |
|
4539 } |
|
4540 |
|
4541 JNIEXPORT jint JNICALL OS_NATIVE( QPixmap_1swt_1paintDevice ) |
|
4542 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
4543 { |
|
4544 QPaintDevice* result = NULL; |
|
4545 SWT_TRY |
|
4546 { |
|
4547 SWT_LOG_JNI_CALL(); |
|
4548 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4549 result = static_cast<QPaintDevice*>( reinterpret_cast<QPixmap*>( static_cast<int>( aHandle ) ) ); |
|
4550 } |
|
4551 SWT_CATCH |
|
4552 return reinterpret_cast<jint>( result ); |
|
4553 } |
|
4554 |
|
4555 // |
|
4556 // QPalette |
|
4557 // |
|
4558 |
|
4559 JNIEXPORT void JNICALL OS_NATIVE( QPalette_1setColor__IIIIII ) |
|
4560 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aGroup, jint aRole, jint aRed, jint aGreen, jint aBlue ) |
|
4561 { |
|
4562 SWT_TRY |
|
4563 { |
|
4564 SWT_LOG_JNI_CALL(); |
|
4565 SWT_LOG_DATA_3( "handle=%x group=%x role=%x ", aHandle, aGroup, aRole ); |
|
4566 const int& red = static_cast<int>(aRed); |
|
4567 const int& green = static_cast<int>(aGreen); |
|
4568 const int& blue = static_cast<int>(aBlue); |
|
4569 QPalette* palette = reinterpret_cast< QPalette* > ( aHandle ); |
|
4570 palette->setColor( static_cast< QPalette::ColorGroup> ( aGroup ), static_cast< QPalette::ColorRole> ( aRole ), QColor( red, green, blue ) ); |
|
4571 } |
|
4572 SWT_CATCH |
|
4573 } |
|
4574 |
|
4575 JNIEXPORT void JNICALL OS_NATIVE( QPalette_1setColor__IIIII ) |
|
4576 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRole, jint aRed, jint aGreen, jint aBlue ) |
|
4577 { |
|
4578 SWT_TRY |
|
4579 { |
|
4580 SWT_LOG_JNI_CALL(); |
|
4581 SWT_LOG_DATA_5( "handle=%x rose=%x red=%x green=%x blue=%x", aHandle, aRole, aRed, aGreen, aBlue ); |
|
4582 const int& red = static_cast<int>(aRed); |
|
4583 const int& green = static_cast<int>(aGreen); |
|
4584 const int& blue = static_cast<int>(aBlue); |
|
4585 QPalette* palette = reinterpret_cast< QPalette* > ( aHandle ); |
|
4586 palette->setColor( static_cast< QPalette::ColorRole> ( aRole ), QColor( red, green, blue ) ); |
|
4587 } |
|
4588 SWT_CATCH |
|
4589 } |
|
4590 |
|
4591 JNIEXPORT jintArray JNICALL OS_NATIVE( QPalette_1color ) |
|
4592 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aGroup, jint aRole ) |
|
4593 { |
|
4594 jintArray color(NULL); |
|
4595 SWT_TRY |
|
4596 { |
|
4597 SWT_LOG_JNI_CALL(); |
|
4598 SWT_LOG_DATA_2( "handle=%x role=%x ", aHandle, aRole ); |
|
4599 QPalette* palette = reinterpret_cast< QPalette* > ( aHandle ); |
|
4600 QColor osColor = palette->color( static_cast< QPalette::ColorGroup> ( aGroup ), |
|
4601 static_cast< QPalette::ColorRole> ( aRole ) ); |
|
4602 int rgb[] = {osColor.red(), osColor.green(), osColor.blue()}; |
|
4603 color = swtApp->jniUtils().NewJavaIntArray( aJniEnv, rgb, 3 ); |
|
4604 } |
|
4605 SWT_CATCH |
|
4606 return color; |
|
4607 } |
|
4608 |
|
4609 JNIEXPORT void JNICALL OS_NATIVE( QPalette_1delete ) |
|
4610 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
4611 { |
|
4612 SWT_TRY |
|
4613 { |
|
4614 SWT_LOG_JNI_CALL(); |
|
4615 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4616 QPalette* palette = reinterpret_cast< QPalette* >( aHandle ); |
|
4617 delete palette; |
|
4618 palette = NULL; |
|
4619 } |
|
4620 SWT_CATCH |
|
4621 } |
|
4622 |
|
4623 JNIEXPORT void JNICALL OS_NATIVE( QPalette_1swt_1setBrush ) |
|
4624 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRole, jint aPixmap) |
|
4625 { |
|
4626 SWT_TRY |
|
4627 { |
|
4628 SWT_LOG_JNI_CALL(); |
|
4629 SWT_LOG_DATA_3( "handle=%x role=%x pixmap=%x", aHandle, aRole, aPixmap ); |
|
4630 QPixmap* pixmap = reinterpret_cast<QPixmap*>(aPixmap); |
|
4631 QPalette* palette = reinterpret_cast< QPalette* > ( aHandle ); |
|
4632 if(pixmap) |
|
4633 { |
|
4634 palette->setBrush( static_cast< QPalette::ColorRole> ( aRole ), QBrush( *pixmap ) ); |
|
4635 } |
|
4636 else |
|
4637 { |
|
4638 palette->setBrush( static_cast< QPalette::ColorRole> ( aRole ), QBrush() ); |
|
4639 } |
|
4640 } |
|
4641 SWT_CATCH |
|
4642 } |
|
4643 |
|
4644 JNIEXPORT void JNICALL OS_NATIVE( QPalette_1swt_1copyBrushFromPalette ) |
|
4645 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aSourceHandle, jint aRole) |
|
4646 { |
|
4647 SWT_TRY |
|
4648 { |
|
4649 SWT_LOG_JNI_CALL(); |
|
4650 SWT_LOG_DATA_3( "handle=%x source=%x role=%x ", aHandle, aSourceHandle, aRole ); |
|
4651 QPalette* palette = reinterpret_cast<QPalette*> ( aHandle ); |
|
4652 QPalette* sourcePalette = reinterpret_cast<QPalette*> ( aSourceHandle ); |
|
4653 const QPalette::ColorRole& role = static_cast<QPalette::ColorRole> ( aRole ); |
|
4654 const QBrush& brush = sourcePalette->brush( role ); |
|
4655 palette->setBrush( role, brush ); |
|
4656 } |
|
4657 SWT_CATCH |
|
4658 } |
|
4659 |
|
4660 // |
|
4661 // QTimer |
|
4662 // |
|
4663 |
|
4664 JNIEXPORT jint JNICALL OS_NATIVE( QTimer_1new ) |
|
4665 (JNIEnv* aJniEnv , jclass) |
|
4666 { |
|
4667 QTimer* timer = NULL; |
|
4668 SWT_TRY |
|
4669 { |
|
4670 SWT_LOG_JNI_CALL(); |
|
4671 timer = new QTimer(); |
|
4672 } |
|
4673 SWT_CATCH |
|
4674 return POINTER_TO_HANDLE( timer ); |
|
4675 } |
|
4676 |
|
4677 JNIEXPORT void JNICALL OS_NATIVE( QTimer_1setSingleShot ) |
|
4678 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aSingleShot) |
|
4679 { |
|
4680 SWT_TRY |
|
4681 { |
|
4682 SWT_LOG_JNI_CALL(); |
|
4683 SWT_LOG_DATA_2("handle=%x singleShot=%d", aHandle, aSingleShot); |
|
4684 HANDLE_TO_POINTER( QTimer*, timer, aHandle ); |
|
4685 timer->setSingleShot( aSingleShot == JNI_TRUE ? true : false ); |
|
4686 } |
|
4687 SWT_CATCH |
|
4688 } |
|
4689 |
|
4690 JNIEXPORT void JNICALL OS_NATIVE( QTimer_1start ) |
|
4691 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMsec) |
|
4692 { |
|
4693 SWT_TRY |
|
4694 { |
|
4695 SWT_LOG_JNI_CALL(); |
|
4696 SWT_LOG_DATA_2("handle=%x msec=%d", aHandle, aMsec); |
|
4697 HANDLE_TO_POINTER( QTimer*, timer, aHandle ); |
|
4698 timer->start( aMsec ); |
|
4699 } |
|
4700 SWT_CATCH |
|
4701 } |
|
4702 |
|
4703 // |
|
4704 // QFont |
|
4705 // |
|
4706 |
|
4707 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1new__Ljava_lang_String_2IIZ ) |
|
4708 ( JNIEnv* aJniEnv , jclass, jstring aFamily, jint aPointSize, jint aWeight, jboolean aItalic ) |
|
4709 { |
|
4710 QFont* font( NULL); |
|
4711 SWT_TRY |
|
4712 { |
|
4713 SWT_LOG_JNI_CALL(); |
|
4714 SWT_LOG_DATA_4( "family=%s pointSize=%d weight=%d italic=%d", aFamily, aPointSize, aWeight, aItalic ); |
|
4715 font = new QFont( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFamily ), aPointSize, aWeight, aItalic ); |
|
4716 } |
|
4717 SWT_CATCH |
|
4718 return reinterpret_cast< jint >( font ); |
|
4719 } |
|
4720 |
|
4721 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1new__ ) |
|
4722 ( JNIEnv* aJniEnv , jclass ) |
|
4723 { |
|
4724 QFont* font( NULL); |
|
4725 SWT_TRY |
|
4726 { |
|
4727 SWT_LOG_JNI_CALL(); |
|
4728 font = new QFont(); |
|
4729 } |
|
4730 SWT_CATCH |
|
4731 return reinterpret_cast< jint >( font ); |
|
4732 } |
|
4733 |
|
4734 JNIEXPORT void JNICALL OS_NATIVE( QFont_1delete ) |
|
4735 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
4736 { |
|
4737 SWT_TRY |
|
4738 { |
|
4739 SWT_LOG_JNI_CALL(); |
|
4740 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4741 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4742 delete font; |
|
4743 font = NULL; |
|
4744 } |
|
4745 SWT_CATCH |
|
4746 } |
|
4747 |
|
4748 JNIEXPORT jstring JNICALL OS_NATIVE( QFont_1family ) |
|
4749 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
4750 { |
|
4751 jstring javaString( NULL ); |
|
4752 SWT_TRY |
|
4753 { |
|
4754 SWT_LOG_JNI_CALL(); |
|
4755 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4756 QFont* font = reinterpret_cast< QFont* > ( aHandle ); |
|
4757 QString family = font->family(); |
|
4758 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, family ); |
|
4759 } |
|
4760 SWT_CATCH |
|
4761 return javaString; |
|
4762 } |
|
4763 |
|
4764 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1weight ) |
|
4765 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
4766 { |
|
4767 jint weight = -1; |
|
4768 SWT_TRY |
|
4769 { |
|
4770 SWT_LOG_JNI_CALL(); |
|
4771 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4772 QFont* font = reinterpret_cast< QFont* > ( aHandle ); |
|
4773 weight = font->weight(); |
|
4774 } |
|
4775 SWT_CATCH |
|
4776 return weight; |
|
4777 } |
|
4778 |
|
4779 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1pointSize ) |
|
4780 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
4781 { |
|
4782 jint pointSize = -1; |
|
4783 SWT_TRY |
|
4784 { |
|
4785 SWT_LOG_JNI_CALL(); |
|
4786 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4787 QFont* font = reinterpret_cast< QFont* > ( aHandle ); |
|
4788 pointSize = font->pointSize(); |
|
4789 } |
|
4790 SWT_CATCH |
|
4791 return pointSize; |
|
4792 } |
|
4793 |
|
4794 |
|
4795 JNIEXPORT jboolean JNICALL OS_NATIVE( QFont_1italic ) |
|
4796 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
4797 { |
|
4798 jboolean italic = JNI_FALSE; |
|
4799 SWT_TRY |
|
4800 { |
|
4801 SWT_LOG_JNI_CALL(); |
|
4802 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4803 QFont* font = reinterpret_cast< QFont* > ( aHandle ); |
|
4804 italic = font->italic() ? JNI_TRUE : JNI_FALSE; |
|
4805 } |
|
4806 SWT_CATCH |
|
4807 return italic; |
|
4808 } |
|
4809 |
|
4810 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setUnderline ) |
|
4811 (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aEnable) |
|
4812 { |
|
4813 SWT_TRY |
|
4814 { |
|
4815 SWT_LOG_JNI_CALL(); |
|
4816 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4817 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4818 font->setUnderline( aEnable == JNI_TRUE ? true : false ); |
|
4819 } |
|
4820 SWT_CATCH |
|
4821 } |
|
4822 |
|
4823 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setOverline ) |
|
4824 (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aEnable) |
|
4825 { |
|
4826 SWT_TRY |
|
4827 { |
|
4828 SWT_LOG_JNI_CALL(); |
|
4829 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4830 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4831 font->setOverline( aEnable == JNI_TRUE ? true : false ); |
|
4832 } |
|
4833 SWT_CATCH |
|
4834 } |
|
4835 |
|
4836 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setStrikeOut ) |
|
4837 (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aEnable) |
|
4838 { |
|
4839 SWT_TRY |
|
4840 { |
|
4841 SWT_LOG_JNI_CALL(); |
|
4842 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4843 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4844 font->setStrikeOut( aEnable == JNI_TRUE ? true : false ); |
|
4845 } |
|
4846 SWT_CATCH |
|
4847 } |
|
4848 |
|
4849 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setStretch ) |
|
4850 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aStretch) |
|
4851 { |
|
4852 SWT_TRY |
|
4853 { |
|
4854 SWT_LOG_JNI_CALL(); |
|
4855 SWT_LOG_DATA_2("handle=%x streach=%d", aHandle, aStretch); |
|
4856 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4857 font->setStretch( aStretch ); |
|
4858 } |
|
4859 SWT_CATCH |
|
4860 } |
|
4861 |
|
4862 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setFixedPitch ) |
|
4863 (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aEnable) |
|
4864 { |
|
4865 SWT_TRY |
|
4866 { |
|
4867 SWT_LOG_JNI_CALL(); |
|
4868 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4869 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4870 font->setFixedPitch( aEnable == JNI_TRUE ? true : false ); |
|
4871 } |
|
4872 SWT_CATCH |
|
4873 } |
|
4874 |
|
4875 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setStyle ) |
|
4876 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aStyle) |
|
4877 { |
|
4878 SWT_TRY |
|
4879 { |
|
4880 SWT_LOG_JNI_CALL(); |
|
4881 SWT_LOG_DATA_2("handle=%x style=%x", aHandle, aStyle); |
|
4882 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4883 font->setStyle( static_cast<QFont::Style>(aStyle) ); |
|
4884 } |
|
4885 SWT_CATCH |
|
4886 } |
|
4887 |
|
4888 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setWeight ) |
|
4889 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aWeight) |
|
4890 { |
|
4891 SWT_TRY |
|
4892 { |
|
4893 SWT_LOG_JNI_CALL(); |
|
4894 SWT_LOG_DATA_2("handle=%x weight=%d", aHandle, aWeight); |
|
4895 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4896 font->setWeight( aWeight ); |
|
4897 } |
|
4898 SWT_CATCH |
|
4899 } |
|
4900 |
|
4901 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setStyleStrategy ) |
|
4902 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aStrategy) |
|
4903 { |
|
4904 SWT_TRY |
|
4905 { |
|
4906 SWT_LOG_JNI_CALL(); |
|
4907 SWT_LOG_DATA_2("handle=%x strategy=%x", aHandle, aStrategy); |
|
4908 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4909 font->setStyleStrategy( static_cast<QFont::StyleStrategy>(aStrategy) ); |
|
4910 } |
|
4911 SWT_CATCH |
|
4912 } |
|
4913 |
|
4914 JNIEXPORT void JNICALL OS_NATIVE( QFont_1setRawName ) |
|
4915 (JNIEnv* aJniEnv, jclass, jint |
|
4916 #ifdef Q_WS_X11 |
|
4917 aHandle |
|
4918 #endif |
|
4919 , jstring |
|
4920 #ifdef Q_WS_X11 |
|
4921 aRawName |
|
4922 #endif |
|
4923 ) |
|
4924 { |
|
4925 SWT_TRY |
|
4926 { |
|
4927 SWT_LOG_JNI_CALL(); |
|
4928 #ifdef Q_WS_X11 |
|
4929 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4930 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4931 font->setRawName( swtApp->jniUtils().JavaStringToQString( aJniEnv, aRawName ) ); |
|
4932 #endif |
|
4933 } |
|
4934 SWT_CATCH |
|
4935 } |
|
4936 |
|
4937 JNIEXPORT jboolean JNICALL OS_NATIVE( QFont_1underline ) |
|
4938 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
4939 { |
|
4940 jboolean enable = JNI_FALSE; |
|
4941 SWT_TRY |
|
4942 { |
|
4943 SWT_LOG_JNI_CALL(); |
|
4944 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4945 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4946 enable = font->underline(); |
|
4947 } |
|
4948 SWT_CATCH |
|
4949 return enable; |
|
4950 } |
|
4951 |
|
4952 JNIEXPORT jboolean JNICALL OS_NATIVE( QFont_1overline ) |
|
4953 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
4954 { |
|
4955 jboolean enable = JNI_FALSE; |
|
4956 SWT_TRY |
|
4957 { |
|
4958 SWT_LOG_JNI_CALL(); |
|
4959 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4960 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4961 enable = font->overline(); |
|
4962 } |
|
4963 SWT_CATCH |
|
4964 return enable; |
|
4965 } |
|
4966 |
|
4967 JNIEXPORT jboolean JNICALL OS_NATIVE( QFont_1strikeOut ) |
|
4968 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
4969 { |
|
4970 jboolean enable = JNI_FALSE; |
|
4971 SWT_TRY |
|
4972 { |
|
4973 SWT_LOG_JNI_CALL(); |
|
4974 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4975 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4976 enable = font->strikeOut(); |
|
4977 } |
|
4978 SWT_CATCH |
|
4979 return enable; |
|
4980 } |
|
4981 |
|
4982 |
|
4983 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1stretch ) |
|
4984 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
4985 { |
|
4986 jint stretch = -1; |
|
4987 SWT_TRY |
|
4988 { |
|
4989 SWT_LOG_JNI_CALL(); |
|
4990 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
4991 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
4992 stretch = font->stretch(); |
|
4993 } |
|
4994 SWT_CATCH |
|
4995 return stretch; |
|
4996 } |
|
4997 |
|
4998 JNIEXPORT jboolean JNICALL OS_NATIVE( QFont_1fixedPitch ) |
|
4999 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
5000 { |
|
5001 jboolean enable = JNI_FALSE; |
|
5002 SWT_TRY |
|
5003 { |
|
5004 SWT_LOG_JNI_CALL(); |
|
5005 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
5006 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
5007 enable = font->fixedPitch(); |
|
5008 } |
|
5009 SWT_CATCH |
|
5010 return enable; |
|
5011 } |
|
5012 |
|
5013 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1style ) |
|
5014 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
5015 { |
|
5016 jint style = -1; |
|
5017 SWT_TRY |
|
5018 { |
|
5019 SWT_LOG_JNI_CALL(); |
|
5020 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
5021 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
5022 style = font->style(); |
|
5023 } |
|
5024 SWT_CATCH |
|
5025 return style; |
|
5026 } |
|
5027 |
|
5028 JNIEXPORT jint JNICALL OS_NATIVE( QFont_1styleStrategy ) |
|
5029 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
5030 { |
|
5031 jint strategy = -1; |
|
5032 SWT_TRY |
|
5033 { |
|
5034 SWT_LOG_JNI_CALL(); |
|
5035 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
5036 QFont* font = reinterpret_cast< QFont* >( aHandle ); |
|
5037 strategy = font->styleStrategy(); |
|
5038 } |
|
5039 SWT_CATCH |
|
5040 return strategy; |
|
5041 } |
|
5042 |
|
5043 JNIEXPORT jboolean JNICALL OS_NATIVE( QFont_1swt_1equals ) |
|
5044 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aHandle2) |
|
5045 { |
|
5046 bool equals = false; |
|
5047 SWT_TRY |
|
5048 { |
|
5049 SWT_LOG_JNI_CALL(); |
|
5050 SWT_LOG_DATA_2("handle=%x handle2=%x", aHandle, aHandle2); |
|
5051 const QFont* const font = reinterpret_cast<QFont*>( aHandle ); |
|
5052 const QFont* const font2 = reinterpret_cast<QFont*>( aHandle2 ); |
|
5053 if(!font || !font2) |
|
5054 { |
|
5055 equals = (font == font2); |
|
5056 } |
|
5057 else |
|
5058 { |
|
5059 equals = (*font == *font2); |
|
5060 } |
|
5061 } |
|
5062 SWT_CATCH |
|
5063 return equals ? JNI_TRUE : JNI_FALSE; |
|
5064 } |
|
5065 |
|
5066 // |
|
5067 // QFontDatabase in Device |
|
5068 // |
|
5069 |
|
5070 JNIEXPORT jint JNICALL OS_NATIVE( QFontDatabase_1new ) |
|
5071 ( JNIEnv* aJniEnv , jclass ) |
|
5072 { |
|
5073 QFontDatabase* fontDB( NULL); |
|
5074 SWT_TRY |
|
5075 { |
|
5076 SWT_LOG_JNI_CALL(); |
|
5077 fontDB = new QFontDatabase(); |
|
5078 } |
|
5079 SWT_CATCH |
|
5080 return reinterpret_cast< jint >( fontDB ); |
|
5081 } |
|
5082 |
|
5083 JNIEXPORT jobjectArray JNICALL OS_NATIVE( QFontDatabase_1families ) |
|
5084 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5085 { |
|
5086 jobjectArray familiesArray = NULL; |
|
5087 SWT_TRY |
|
5088 { |
|
5089 SWT_LOG_JNI_CALL(); |
|
5090 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
5091 QFontDatabase* fontDb = reinterpret_cast< QFontDatabase* > ( aHandle ); |
|
5092 familiesArray = swtApp->jniUtils().NewJavaStringArray( aJniEnv, fontDb->families() ); |
|
5093 } |
|
5094 SWT_CATCH |
|
5095 return familiesArray; |
|
5096 } |
|
5097 |
|
5098 JNIEXPORT jintArray JNICALL OS_NATIVE( QFontDatabase_1swt_1heights ) |
|
5099 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFamily, jstring aStyle) |
|
5100 { |
|
5101 jintArray heightsArray = 0; |
|
5102 SWT_TRY |
|
5103 { |
|
5104 SWT_LOG_JNI_CALL(); |
|
5105 SWT_LOG_DATA_3("handle=%x family=%x style=%x", aHandle, aFamily, aStyle ); |
|
5106 QFontDatabase* fontDb = reinterpret_cast< QFontDatabase* > ( aHandle ); |
|
5107 QList<int> heights = aStyle == NULL? fontDb->pointSizes( swtApp->jniUtils().JavaStringToQString(aJniEnv, aFamily) ): |
|
5108 fontDb->pointSizes( swtApp->jniUtils().JavaStringToQString(aJniEnv, aFamily), swtApp->jniUtils().JavaStringToQString(aJniEnv, aStyle) ); |
|
5109 const int count = heights.size(); |
|
5110 if(count > 0) |
|
5111 { |
|
5112 QVector<int> handles(count); |
|
5113 int* handleData = handles.data(); |
|
5114 for(int i = 0; i < count; ++i) |
|
5115 { |
|
5116 handleData[i] = heights.at(i); |
|
5117 } |
|
5118 heightsArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, handleData, count ); |
|
5119 } |
|
5120 } |
|
5121 SWT_CATCH |
|
5122 return heightsArray; |
|
5123 } |
|
5124 |
|
5125 JNIEXPORT jboolean JNICALL OS_NATIVE( QFontDatabase_1isScalable ) |
|
5126 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFamily, jstring aStyle) |
|
5127 { |
|
5128 bool scalable = false; |
|
5129 SWT_TRY |
|
5130 { |
|
5131 SWT_LOG_JNI_CALL(); |
|
5132 SWT_LOG_DATA_3("handle=%x family=%x", aHandle, aFamily, aStyle ); |
|
5133 QFontDatabase* fontDb = reinterpret_cast< QFontDatabase* > ( aHandle ); |
|
5134 scalable = aStyle == NULL? fontDb->isScalable( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFamily ) ): |
|
5135 fontDb->isScalable( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFamily ), swtApp->jniUtils().JavaStringToQString( aJniEnv, aStyle ) ); |
|
5136 } |
|
5137 SWT_CATCH |
|
5138 return scalable; |
|
5139 } |
|
5140 |
|
5141 JNIEXPORT jobjectArray JNICALL OS_NATIVE( QFontDatabase_1styles ) |
|
5142 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFamily ) |
|
5143 { |
|
5144 jobjectArray stylesArray = NULL; |
|
5145 SWT_TRY |
|
5146 { |
|
5147 SWT_LOG_JNI_CALL(); |
|
5148 SWT_LOG_DATA_2("handle=%x family=%x", aHandle, aFamily); |
|
5149 QFontDatabase* fontDb = reinterpret_cast< QFontDatabase* > ( aHandle ); |
|
5150 stylesArray = swtApp->jniUtils().NewJavaStringArray( aJniEnv, fontDb->styles( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFamily ) ) ); |
|
5151 } |
|
5152 SWT_CATCH |
|
5153 return stylesArray; |
|
5154 } |
|
5155 |
|
5156 JNIEXPORT jboolean JNICALL OS_NATIVE( QFontDatabase_1bold ) |
|
5157 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFamily, jstring aStyle) |
|
5158 { |
|
5159 bool bold = false; |
|
5160 SWT_TRY |
|
5161 { |
|
5162 SWT_LOG_JNI_CALL(); |
|
5163 SWT_LOG_DATA_3("handle=%x family=%x", aHandle, aFamily, aStyle ); |
|
5164 QFontDatabase* fontDb = reinterpret_cast< QFontDatabase* > ( aHandle ); |
|
5165 bold = fontDb->bold( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFamily ), swtApp->jniUtils().JavaStringToQString( aJniEnv, aStyle ) ); |
|
5166 } |
|
5167 SWT_CATCH |
|
5168 return bold; |
|
5169 } |
|
5170 |
|
5171 JNIEXPORT jboolean JNICALL OS_NATIVE( QFontDatabase_1italic ) |
|
5172 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFamily, jstring aStyle) |
|
5173 { |
|
5174 bool italic = false; |
|
5175 SWT_TRY |
|
5176 { |
|
5177 SWT_LOG_JNI_CALL(); |
|
5178 SWT_LOG_DATA_3("handle=%x family=%x", aHandle, aFamily, aStyle ); |
|
5179 QFontDatabase* fontDb = reinterpret_cast< QFontDatabase* > ( aHandle ); |
|
5180 italic = fontDb->italic( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFamily ), swtApp->jniUtils().JavaStringToQString( aJniEnv, aStyle ) ); |
|
5181 } |
|
5182 SWT_CATCH |
|
5183 return italic; |
|
5184 } |
|
5185 |
|
5186 JNIEXPORT void JNICALL OS_NATIVE( QFontDatabase_1delete ) |
|
5187 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
5188 { |
|
5189 SWT_TRY |
|
5190 { |
|
5191 SWT_LOG_JNI_CALL(); |
|
5192 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
5193 QFontDatabase* fontDB = reinterpret_cast< QFontDatabase* >( aHandle ); |
|
5194 delete fontDB; |
|
5195 fontDB = NULL; |
|
5196 } |
|
5197 SWT_CATCH |
|
5198 } |
|
5199 |
|
5200 // |
|
5201 // ListModel |
|
5202 // |
|
5203 |
|
5204 JNIEXPORT jint JNICALL OS_NATIVE( ListModel_1new ) |
|
5205 ( JNIEnv* aJniEnv , jclass, jint aLayoutStyle, jint aParent, jint aListType ) |
|
5206 { |
|
5207 ListModel* dataModel(NULL); |
|
5208 SWT_TRY |
|
5209 { |
|
5210 SWT_LOG_JNI_CALL(); |
|
5211 SWT_LOG_DATA_3( "layoutStyle=%d parent=%x listType=%d", aLayoutStyle, aParent, aListType ); |
|
5212 HANDLE_TO_POINTER( QListView*, listView, aParent ); |
|
5213 dataModel = ListModel::createDataModel( aListType, aLayoutStyle, listView ); |
|
5214 } |
|
5215 SWT_CATCH |
|
5216 return reinterpret_cast<jint>(dataModel); |
|
5217 } |
|
5218 |
|
5219 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1beginInsertRows ) |
|
5220 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aParentIndexHandle, jint aFirst, jint aLast ) |
|
5221 { |
|
5222 SWT_TRY |
|
5223 { |
|
5224 SWT_LOG_JNI_CALL(); |
|
5225 SWT_LOG_DATA_4("handle=%x parentIdxHandle=%x first=%d last=%d ", aHandle, aParentIndexHandle, aFirst, aLast); |
|
5226 ListModel* listModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5227 if ( aParentIndexHandle!= 0 ) |
|
5228 { |
|
5229 QModelIndex* modelIndex = reinterpret_cast< QModelIndex* > ( aHandle ); |
|
5230 listModel->beginInsertRows( *modelIndex, aFirst, aLast ); |
|
5231 } |
|
5232 else |
|
5233 { |
|
5234 listModel->beginInsertRows( QModelIndex(), aFirst, aLast ); |
|
5235 } |
|
5236 } |
|
5237 SWT_CATCH |
|
5238 } |
|
5239 |
|
5240 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1endInsertRows ) |
|
5241 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5242 { |
|
5243 SWT_TRY |
|
5244 { |
|
5245 SWT_LOG_JNI_CALL(); |
|
5246 SWT_LOG_DATA_1("handle=%x ", aHandle); |
|
5247 ListModel* listModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5248 listModel->endInsertRows(); |
|
5249 } |
|
5250 SWT_CATCH |
|
5251 } |
|
5252 |
|
5253 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1beginRemoveRows ) |
|
5254 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aParentIndexHandle, jint aFirst, jint aLast ) |
|
5255 { |
|
5256 SWT_TRY |
|
5257 { |
|
5258 SWT_LOG_JNI_CALL(); |
|
5259 SWT_LOG_DATA_4("handle=%x parentIdxHandle=%x first=%d last=%d ", aHandle, aParentIndexHandle, aFirst, aLast); |
|
5260 ListModel* listModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5261 if ( aParentIndexHandle!= 0 ) |
|
5262 { |
|
5263 QModelIndex* modelIndex = reinterpret_cast< QModelIndex* > ( aHandle ); |
|
5264 listModel->beginRemoveRows( *modelIndex, aFirst, aLast ); |
|
5265 } |
|
5266 else |
|
5267 { |
|
5268 listModel->beginRemoveRows( QModelIndex(), aFirst, aLast ); |
|
5269 } |
|
5270 } |
|
5271 SWT_CATCH |
|
5272 } |
|
5273 |
|
5274 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1endRemoveRows ) |
|
5275 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5276 { |
|
5277 SWT_TRY |
|
5278 { |
|
5279 SWT_LOG_JNI_CALL(); |
|
5280 SWT_LOG_DATA_1("handle=%x ", aHandle); |
|
5281 ListModel* listModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5282 listModel->endRemoveRows(); |
|
5283 } |
|
5284 SWT_CATCH |
|
5285 } |
|
5286 |
|
5287 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1setCheckState ) |
|
5288 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aSelectionHandle, jint aState ) |
|
5289 { |
|
5290 SWT_TRY |
|
5291 { |
|
5292 SWT_LOG_JNI_CALL(); |
|
5293 SWT_LOG_DATA_3("handle=%x selectionHandle=%x checkState=%x ", aHandle, aSelectionHandle, aState ); |
|
5294 ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5295 QItemSelection* selection = reinterpret_cast<QItemSelection* > ( aSelectionHandle ); |
|
5296 listDataModel->setCheckState( *selection, static_cast< Qt::CheckState > ( aState ) ); |
|
5297 } |
|
5298 SWT_CATCH |
|
5299 } |
|
5300 |
|
5301 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1append__ILjava_lang_String_2 ) |
|
5302 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString ) |
|
5303 { |
|
5304 SWT_TRY |
|
5305 { |
|
5306 SWT_LOG_JNI_CALL(); |
|
5307 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
5308 ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5309 listDataModel->appendItem( swtApp->jniUtils().JavaStringToQString( aJniEnv, aString ) ); |
|
5310 } |
|
5311 SWT_CATCH |
|
5312 } |
|
5313 |
|
5314 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1append__ILjava_lang_String_2I ) |
|
5315 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString, jint aImageHandle ) |
|
5316 { |
|
5317 SWT_TRY |
|
5318 { |
|
5319 SWT_LOG_JNI_CALL(); |
|
5320 SWT_LOG_DATA_2("handle=%x imageHandle=%x", aHandle, aImageHandle); |
|
5321 ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5322 QPixmap* pixmap = reinterpret_cast< QPixmap* >( aImageHandle ); |
|
5323 listDataModel->appendItem( swtApp->jniUtils().JavaStringToQString( aJniEnv, aString ), pixmap ); |
|
5324 } |
|
5325 SWT_CATCH |
|
5326 } |
|
5327 |
|
5328 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1append__ILjava_lang_String_2_3IILjava_lang_String_2_3II ) |
|
5329 ( JNIEnv* aJniEnv, jclass, jint aHandle, jstring aDetailText, jintArray aDetailImageHandles, jint aDetailImageCount, jstring aHeadingText, jintArray aHeadingImageHandles, jint aHeadingImageCount ) |
|
5330 { |
|
5331 SWT_TRY |
|
5332 { |
|
5333 SWT_LOG_JNI_CALL(); |
|
5334 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
5335 |
|
5336 jboolean isCopy; |
|
5337 jint* imagesHandles = NULL; |
|
5338 |
|
5339 const QPixmap** detailImages = const_cast<const QPixmap**>(new QPixmap*[aDetailImageCount]); |
|
5340 if( !detailImages ) |
|
5341 { |
|
5342 throw std::bad_alloc(); |
|
5343 } |
|
5344 if(aDetailImageHandles) |
|
5345 { |
|
5346 imagesHandles = aJniEnv->GetIntArrayElements(aDetailImageHandles, &isCopy); |
|
5347 if( !imagesHandles ) |
|
5348 { |
|
5349 throw std::bad_alloc(); |
|
5350 } |
|
5351 for(int i = 0; i < aDetailImageCount; i++) |
|
5352 { |
|
5353 detailImages[i] = reinterpret_cast< QPixmap* >( imagesHandles[i] ); |
|
5354 } |
|
5355 aJniEnv->ReleaseIntArrayElements(aDetailImageHandles, imagesHandles, JNI_ABORT); |
|
5356 } |
|
5357 |
|
5358 const QPixmap** headingImages = const_cast<const QPixmap**>(new QPixmap*[aHeadingImageCount]); |
|
5359 if( !headingImages ) |
|
5360 { |
|
5361 throw std::bad_alloc(); |
|
5362 } |
|
5363 if(aHeadingImageHandles) |
|
5364 { |
|
5365 imagesHandles = aJniEnv->GetIntArrayElements(aHeadingImageHandles, &isCopy); |
|
5366 if( !imagesHandles ) |
|
5367 { |
|
5368 throw std::bad_alloc(); |
|
5369 } |
|
5370 for(int i = 0; i < aHeadingImageCount; i++) |
|
5371 { |
|
5372 headingImages[i] = reinterpret_cast< QPixmap* >( imagesHandles[i] ); |
|
5373 } |
|
5374 aJniEnv->ReleaseIntArrayElements(aHeadingImageHandles, imagesHandles, JNI_ABORT); |
|
5375 } |
|
5376 |
|
5377 ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5378 listDataModel->appendItem( swtApp->jniUtils().JavaStringToQString( aJniEnv, aDetailText ), detailImages, aDetailImageCount, |
|
5379 swtApp->jniUtils().JavaStringToQString( aJniEnv, aHeadingText ), headingImages, aHeadingImageCount ); |
|
5380 } |
|
5381 SWT_CATCH |
|
5382 } |
|
5383 |
|
5384 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1insert__ILjava_lang_String_2I ) |
|
5385 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString, jint aIndex ) |
|
5386 { |
|
5387 SWT_TRY |
|
5388 { |
|
5389 SWT_LOG_JNI_CALL(); |
|
5390 SWT_LOG_DATA_2("handle=%x index=%x ", aHandle, aIndex ); |
|
5391 ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5392 listDataModel->insertItem( aIndex, swtApp->jniUtils().JavaStringToQString( aJniEnv, aString ) ); |
|
5393 } |
|
5394 SWT_CATCH |
|
5395 } |
|
5396 |
|
5397 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1insert__ILjava_lang_String_2II ) |
|
5398 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString, jint aIndex, jint aImageHandle ) |
|
5399 { |
|
5400 SWT_TRY |
|
5401 { |
|
5402 SWT_LOG_JNI_CALL(); |
|
5403 SWT_LOG_DATA_3("handle=%x index=%x imageHandle=%x ", aHandle, aIndex, aImageHandle); |
|
5404 ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5405 QPixmap* pixmap = reinterpret_cast< QPixmap* >( aImageHandle ); |
|
5406 listDataModel->insertItem( aIndex, swtApp->jniUtils().JavaStringToQString( aJniEnv, aString ), pixmap ); |
|
5407 } |
|
5408 SWT_CATCH |
|
5409 } |
|
5410 |
|
5411 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1layoutAboutToBeChanged ) |
|
5412 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5413 { |
|
5414 SWT_TRY |
|
5415 { |
|
5416 SWT_LOG_JNI_CALL(); |
|
5417 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5418 ListModel* dataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5419 dataModel->emitLayoutAboutToBeChanged(); |
|
5420 } |
|
5421 SWT_CATCH |
|
5422 } |
|
5423 |
|
5424 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1layoutChanged ) |
|
5425 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5426 { |
|
5427 SWT_TRY |
|
5428 { |
|
5429 SWT_LOG_JNI_CALL(); |
|
5430 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5431 ListModel* dataModdel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5432 dataModdel->emitLayoutChanged(); |
|
5433 } |
|
5434 SWT_CATCH |
|
5435 } |
|
5436 |
|
5437 |
|
5438 JNIEXPORT jstring JNICALL OS_NATIVE(ListModel_1itemString) |
|
5439 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
5440 { |
|
5441 jstring javaString = NULL; |
|
5442 SWT_TRY |
|
5443 { |
|
5444 SWT_LOG_JNI_CALL(); |
|
5445 SWT_LOG_DATA_2( "handle=%x index=%d ", aHandle, aIndex ); |
|
5446 ListModel* dataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5447 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, dataModel->itemString(aIndex) ); |
|
5448 } |
|
5449 SWT_CATCH |
|
5450 return javaString; |
|
5451 } |
|
5452 |
|
5453 JNIEXPORT jint JNICALL OS_NATIVE( ListModel_1itemHeight ) |
|
5454 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5455 { |
|
5456 jint height = 0; |
|
5457 SWT_TRY |
|
5458 { |
|
5459 SWT_LOG_JNI_CALL(); |
|
5460 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5461 ListModel* dataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5462 height = dataModel->itemHeight(); |
|
5463 } |
|
5464 SWT_CATCH |
|
5465 return height; |
|
5466 } |
|
5467 |
|
5468 JNIEXPORT jint JNICALL OS_NATIVE( ListModel_1insertPosition ) |
|
5469 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString, jboolean aAscent ) |
|
5470 { |
|
5471 jint pos = 0; |
|
5472 SWT_TRY |
|
5473 { |
|
5474 SWT_LOG_JNI_CALL(); |
|
5475 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5476 ListModel* dataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5477 pos = dataModel->insertPosition(swtApp->jniUtils().JavaStringToQString(aJniEnv, aString), aAscent == JNI_TRUE ? true : false); |
|
5478 } |
|
5479 SWT_CATCH |
|
5480 return pos; |
|
5481 } |
|
5482 |
|
5483 JNIEXPORT jobjectArray JNICALL OS_NATIVE( ListModel_1itemStrings ) |
|
5484 ( JNIEnv* aJniEnv, jclass, jint aHandle ) |
|
5485 { |
|
5486 jobjectArray stringArray = NULL; |
|
5487 SWT_TRY |
|
5488 { |
|
5489 SWT_LOG_JNI_CALL(); |
|
5490 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5491 ListModel* dataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5492 stringArray = dataModel->itemStrings(aJniEnv); |
|
5493 } |
|
5494 SWT_CATCH |
|
5495 return stringArray; |
|
5496 } |
|
5497 |
|
5498 JNIEXPORT jint JNICALL OS_NATIVE( ListModel_1indexOf ) |
|
5499 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aString, jint aStart ) |
|
5500 { |
|
5501 jint index = -1; |
|
5502 SWT_TRY |
|
5503 { |
|
5504 SWT_LOG_JNI_CALL(); |
|
5505 SWT_LOG_DATA_2( "handle=%x start=%d", aHandle, aStart ); |
|
5506 ListModel* dataModel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5507 index = dataModel->indexOf(swtApp->jniUtils().JavaStringToQString(aJniEnv, aString), aStart); |
|
5508 } |
|
5509 SWT_CATCH |
|
5510 return index; |
|
5511 } |
|
5512 |
|
5513 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1remove ) |
|
5514 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
5515 { |
|
5516 SWT_TRY |
|
5517 { |
|
5518 SWT_LOG_JNI_CALL(); |
|
5519 SWT_LOG_DATA_2( "handle=%x index=%d ", aHandle, aIndex ); |
|
5520 ListModel* dataModdel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5521 dataModdel->remove(aIndex); |
|
5522 } |
|
5523 SWT_CATCH |
|
5524 } |
|
5525 |
|
5526 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1setItem__IILjava_lang_String_2 ) |
|
5527 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jstring aString ) |
|
5528 { |
|
5529 SWT_TRY |
|
5530 { |
|
5531 SWT_LOG_JNI_CALL(); |
|
5532 SWT_LOG_DATA_2( "handle=%x index=%d ", aHandle, aIndex ); |
|
5533 ListModel* dataModdel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5534 dataModdel->setItem(aIndex, swtApp->jniUtils().JavaStringToQString(aJniEnv, aString)); |
|
5535 } |
|
5536 SWT_CATCH |
|
5537 } |
|
5538 |
|
5539 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1setItem__IILjava_lang_String_2I ) |
|
5540 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jstring aString, jint aImageHandle ) |
|
5541 { |
|
5542 SWT_TRY |
|
5543 { |
|
5544 SWT_LOG_JNI_CALL(); |
|
5545 SWT_LOG_DATA_3( "handle=%x index=%d imageHandle=%x", aHandle, aIndex, aImageHandle ); |
|
5546 ListModel* dataModdel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5547 QPixmap* pixmap = reinterpret_cast< QPixmap* >( aImageHandle ); |
|
5548 dataModdel->setItem(aIndex, swtApp->jniUtils().JavaStringToQString(aJniEnv, aString), pixmap ); |
|
5549 } |
|
5550 SWT_CATCH |
|
5551 } |
|
5552 |
|
5553 JNIEXPORT void JNICALL OS_NATIVE( ListModel_1clearList ) |
|
5554 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5555 { |
|
5556 SWT_TRY |
|
5557 { |
|
5558 SWT_LOG_JNI_CALL(); |
|
5559 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5560 ListModel* dataModdel = reinterpret_cast< ListModel* > ( aHandle ); |
|
5561 dataModdel->clearList(); |
|
5562 } |
|
5563 SWT_CATCH |
|
5564 } |
|
5565 |
|
5566 // |
|
5567 // ListItemDelegate |
|
5568 // |
|
5569 |
|
5570 JNIEXPORT jint JNICALL OS_NATIVE( ListBoxItemDelegate_1new ) |
|
5571 ( JNIEnv* aJniEnv , jclass, jint aParent ) |
|
5572 { |
|
5573 ListBoxItemDelegate* itemDelegate( NULL ); |
|
5574 SWT_TRY |
|
5575 { |
|
5576 SWT_LOG_JNI_CALL(); |
|
5577 SWT_LOG_DATA_1("parent=%x ", aParent); |
|
5578 HANDLE_TO_POINTER( QObject*, parentObject, aParent ); |
|
5579 itemDelegate = new ListBoxItemDelegate( parentObject ); |
|
5580 } |
|
5581 SWT_CATCH |
|
5582 return POINTER_TO_HANDLE( itemDelegate ); |
|
5583 } |
|
5584 |
|
5585 JNIEXPORT void JNICALL OS_NATIVE( ListBoxItemDelegate_1setHeadingFont ) |
|
5586 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle ) |
|
5587 { |
|
5588 SWT_TRY |
|
5589 { |
|
5590 SWT_LOG_JNI_CALL(); |
|
5591 SWT_LOG_DATA_2( "handle=%x fontHandle=%x ", aHandle, aFontHandle ); |
|
5592 HANDLE_TO_POINTER( ListBoxItemDelegate*, itemDelegate, aHandle ); |
|
5593 QFont* font = reinterpret_cast< QFont* > ( aFontHandle ); |
|
5594 itemDelegate->setHeadingFont( font ); |
|
5595 } |
|
5596 SWT_CATCH |
|
5597 } |
|
5598 |
|
5599 // |
|
5600 // QAbstractItemModel |
|
5601 // |
|
5602 |
|
5603 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemModel_1index ) |
|
5604 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aColumn, jint aParentIndexHandle ) |
|
5605 { |
|
5606 QModelIndex* modelIndex( NULL ); |
|
5607 SWT_TRY |
|
5608 { |
|
5609 SWT_LOG_JNI_CALL(); |
|
5610 SWT_LOG_DATA_4( "handle=%x row=%d column=%d parentIndexHandle=%x ", aHandle, aRow, aColumn, aParentIndexHandle ); |
|
5611 QAbstractItemModel* itemModdel = reinterpret_cast< QAbstractItemModel* > ( aHandle ); |
|
5612 QModelIndex* parentIndex; |
|
5613 if( aParentIndexHandle == 0 ) |
|
5614 { |
|
5615 modelIndex = new QModelIndex( itemModdel->index(aRow, aColumn, QModelIndex() ) ); |
|
5616 } |
|
5617 else |
|
5618 { |
|
5619 parentIndex = reinterpret_cast< QModelIndex* > ( aParentIndexHandle ); |
|
5620 modelIndex = new QModelIndex( itemModdel->index(aRow, aColumn, *parentIndex ) ); |
|
5621 } |
|
5622 } |
|
5623 SWT_CATCH |
|
5624 return reinterpret_cast< jint >( modelIndex ); |
|
5625 } |
|
5626 |
|
5627 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemModel_1rowCount ) |
|
5628 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5629 { |
|
5630 jint count = 0; |
|
5631 SWT_TRY |
|
5632 { |
|
5633 SWT_LOG_JNI_CALL(); |
|
5634 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5635 QAbstractItemModel* itemModdel = reinterpret_cast< QAbstractItemModel* > ( aHandle ); |
|
5636 count = itemModdel->rowCount(); |
|
5637 } |
|
5638 SWT_CATCH |
|
5639 return count; |
|
5640 } |
|
5641 |
|
5642 // |
|
5643 // QModelIndex |
|
5644 // |
|
5645 |
|
5646 JNIEXPORT jint JNICALL OS_NATIVE( QModelIndex_1row ) |
|
5647 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5648 { |
|
5649 jint row(-1); |
|
5650 SWT_TRY |
|
5651 { |
|
5652 SWT_LOG_JNI_CALL(); |
|
5653 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5654 QModelIndex* modelIndex = reinterpret_cast< QModelIndex* >( aHandle ); |
|
5655 if(modelIndex != NULL && modelIndex->isValid()) |
|
5656 { |
|
5657 row = modelIndex->row(); |
|
5658 } |
|
5659 } |
|
5660 SWT_CATCH |
|
5661 return row; |
|
5662 } |
|
5663 |
|
5664 JNIEXPORT void JNICALL OS_NATIVE( QModelIndex_1delete ) |
|
5665 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5666 { |
|
5667 SWT_TRY |
|
5668 { |
|
5669 SWT_LOG_JNI_CALL(); |
|
5670 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
5671 QModelIndex* modelIndex = reinterpret_cast< QModelIndex* >( aHandle ); |
|
5672 delete modelIndex; |
|
5673 } |
|
5674 SWT_CATCH |
|
5675 } |
|
5676 |
|
5677 // |
|
5678 // QItemSelectionModel |
|
5679 // |
|
5680 |
|
5681 JNIEXPORT void JNICALL OS_NATIVE( QItemSelectionModel_1select__III ) |
|
5682 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndexHandle, jint aCommand ) |
|
5683 { |
|
5684 SWT_TRY |
|
5685 { |
|
5686 SWT_LOG_JNI_CALL(); |
|
5687 SWT_LOG_DATA_3("handle=%x indexHandle=%d, command=%x ", aHandle, aIndexHandle, aCommand); |
|
5688 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5689 QModelIndex* modelIndex = reinterpret_cast<QModelIndex* > ( aIndexHandle ); |
|
5690 itemSelectionModel->select( *modelIndex, static_cast< QItemSelectionModel::SelectionFlags > ( aCommand ) ); |
|
5691 } |
|
5692 SWT_CATCH |
|
5693 } |
|
5694 |
|
5695 JNIEXPORT void JNICALL OS_NATIVE( QItemSelectionModel_1select_1_1set ) |
|
5696 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aSelectionHandle, jint aCommand ) |
|
5697 { |
|
5698 SWT_TRY |
|
5699 { |
|
5700 SWT_LOG_JNI_CALL(); |
|
5701 SWT_LOG_DATA_3("handle=%x selectionHandle=%d, command=%x ", aHandle, aSelectionHandle, aCommand); |
|
5702 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5703 QItemSelection* selection = reinterpret_cast<QItemSelection* > ( aSelectionHandle ); |
|
5704 itemSelectionModel->select( *selection, static_cast< QItemSelectionModel::SelectionFlags > ( aCommand ) ); |
|
5705 } |
|
5706 SWT_CATCH |
|
5707 } |
|
5708 |
|
5709 JNIEXPORT void JNICALL OS_NATIVE( QItemSelectionModel_1select__IIII ) |
|
5710 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aStartIndexHandle, jint aEndIndexHandle, jint aCommand ) |
|
5711 { |
|
5712 SWT_TRY |
|
5713 { |
|
5714 SWT_LOG_JNI_CALL(); |
|
5715 SWT_LOG_DATA_4("handle=%x startIndexHandle=%d, endIndexHandle=%d, command=%x ", aHandle, aStartIndexHandle, aEndIndexHandle, aCommand); |
|
5716 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5717 QModelIndex* startModelIndex = reinterpret_cast<QModelIndex* > ( aStartIndexHandle ); |
|
5718 QModelIndex* endModelIndex = reinterpret_cast<QModelIndex* > ( aEndIndexHandle ); |
|
5719 QItemSelection selection( *startModelIndex, *endModelIndex ); |
|
5720 itemSelectionModel->select( selection, static_cast< QItemSelectionModel::SelectionFlags > ( aCommand ) ); |
|
5721 } |
|
5722 SWT_CATCH |
|
5723 } |
|
5724 |
|
5725 JNIEXPORT void JNICALL OS_NATIVE( QItemSelectionModel_1clearSelection ) |
|
5726 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5727 { |
|
5728 SWT_TRY |
|
5729 { |
|
5730 SWT_LOG_JNI_CALL(); |
|
5731 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
5732 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5733 itemSelectionModel->clearSelection(); |
|
5734 } |
|
5735 SWT_CATCH |
|
5736 } |
|
5737 |
|
5738 JNIEXPORT jint JNICALL OS_NATIVE( QItemSelectionModel_1currentIndex ) |
|
5739 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5740 { |
|
5741 QModelIndex* currentModelIndex = NULL; |
|
5742 SWT_TRY |
|
5743 { |
|
5744 SWT_LOG_JNI_CALL(); |
|
5745 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
5746 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5747 currentModelIndex = new QModelIndex( itemSelectionModel->currentIndex() ); |
|
5748 } |
|
5749 SWT_CATCH |
|
5750 return reinterpret_cast< jint >( currentModelIndex ); |
|
5751 } |
|
5752 |
|
5753 JNIEXPORT void JNICALL OS_NATIVE( QItemSelectionModel_1setCurrentIndex ) |
|
5754 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndexHandle, jint aCommand ) |
|
5755 { |
|
5756 SWT_TRY |
|
5757 { |
|
5758 SWT_LOG_JNI_CALL(); |
|
5759 SWT_LOG_DATA_3("handle=%x indexHandle=%d, command=%x ", aHandle, aIndexHandle, aCommand); |
|
5760 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5761 QModelIndex* modelIndex = reinterpret_cast<QModelIndex* > ( aIndexHandle ); |
|
5762 itemSelectionModel->setCurrentIndex( *modelIndex, static_cast< QItemSelectionModel::SelectionFlags > ( aCommand ) ); |
|
5763 } |
|
5764 SWT_CATCH |
|
5765 } |
|
5766 |
|
5767 JNIEXPORT jintArray JNICALL OS_NATIVE( QItemSelectionModel_1selectedRows ) |
|
5768 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn ) |
|
5769 { |
|
5770 jintArray javaArray( NULL ); |
|
5771 SWT_TRY |
|
5772 { |
|
5773 SWT_LOG_JNI_CALL(); |
|
5774 SWT_LOG_DATA_2("handle=%x column=%d ", aHandle, aColumn ); |
|
5775 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5776 QModelIndexList indexList = itemSelectionModel->selectedRows( aColumn ); |
|
5777 const int count = indexList.count(); |
|
5778 if( count > 0 ) |
|
5779 { |
|
5780 QVector<int> indexHandles( count ); |
|
5781 int* indexData = indexHandles.data(); |
|
5782 for(int i = 0; i < count; ++i) |
|
5783 { |
|
5784 indexData[i] = indexList.value( i ).row(); |
|
5785 } |
|
5786 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, indexData, count ); |
|
5787 } |
|
5788 } |
|
5789 SWT_CATCH |
|
5790 return javaArray; |
|
5791 } |
|
5792 |
|
5793 JNIEXPORT jboolean JNICALL OS_NATIVE(QItemSelectionModel_1isSelected) |
|
5794 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndexHandle ) |
|
5795 { |
|
5796 jboolean isSelected = JNI_FALSE; |
|
5797 SWT_TRY |
|
5798 { |
|
5799 SWT_LOG_JNI_CALL(); |
|
5800 SWT_LOG_DATA_2("handle=%x indexHandle=x ", aHandle, aIndexHandle); |
|
5801 QItemSelectionModel* itemSelectionModel = reinterpret_cast<QItemSelectionModel* > ( aHandle ); |
|
5802 QModelIndex* modelIndex = reinterpret_cast<QModelIndex* > ( aIndexHandle ); |
|
5803 isSelected = itemSelectionModel->isSelected( *modelIndex ); |
|
5804 } |
|
5805 SWT_CATCH |
|
5806 return isSelected; |
|
5807 } |
|
5808 |
|
5809 // |
|
5810 // QAbstractItemView |
|
5811 // |
|
5812 |
|
5813 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1setSelectionBehavior ) |
|
5814 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aBehavior ) |
|
5815 { |
|
5816 SWT_TRY |
|
5817 { |
|
5818 SWT_LOG_JNI_CALL(); |
|
5819 SWT_LOG_DATA_2("handle=%x behavior=%x ", aHandle, aBehavior ); |
|
5820 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5821 itemView->setSelectionBehavior( static_cast< QAbstractItemView::SelectionBehavior >( aBehavior ) ); |
|
5822 } |
|
5823 SWT_CATCH |
|
5824 } |
|
5825 |
|
5826 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1setSelectionMode ) |
|
5827 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode ) |
|
5828 { |
|
5829 SWT_TRY |
|
5830 { |
|
5831 SWT_LOG_JNI_CALL(); |
|
5832 SWT_LOG_DATA_2("handle=%x mode=%x ", aHandle, aMode ); |
|
5833 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5834 itemView->setSelectionMode( static_cast< QAbstractItemView::SelectionMode >( aMode ) ); |
|
5835 } |
|
5836 SWT_CATCH |
|
5837 } |
|
5838 |
|
5839 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1setModel ) |
|
5840 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aDataModelHandle ) |
|
5841 { |
|
5842 SWT_TRY |
|
5843 { |
|
5844 SWT_LOG_JNI_CALL(); |
|
5845 SWT_LOG_DATA_2("handle=%x dataModel=%x ", aHandle, aDataModelHandle ); |
|
5846 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5847 QAbstractItemModel* dataModel = reinterpret_cast< QAbstractItemModel*>( aDataModelHandle ); |
|
5848 itemView->setModel( dataModel ); |
|
5849 } |
|
5850 SWT_CATCH |
|
5851 } |
|
5852 |
|
5853 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemView_1selectionModel ) |
|
5854 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
5855 { |
|
5856 QItemSelectionModel* selectionModel( NULL ); |
|
5857 SWT_TRY |
|
5858 { |
|
5859 SWT_LOG_JNI_CALL(); |
|
5860 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
5861 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5862 selectionModel = itemView->selectionModel(); |
|
5863 } |
|
5864 SWT_CATCH |
|
5865 return reinterpret_cast< jint >( selectionModel ); |
|
5866 } |
|
5867 |
|
5868 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1scrollTo ) |
|
5869 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndexHandle, jint aScrollHint ) |
|
5870 { |
|
5871 SWT_TRY |
|
5872 { |
|
5873 SWT_LOG_JNI_CALL(); |
|
5874 SWT_LOG_DATA_3("handle=%x aIndex=%x scrollHint=%d ", aHandle, aIndexHandle, aScrollHint ); |
|
5875 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5876 QModelIndex* modelIndex = reinterpret_cast< QModelIndex* > ( aIndexHandle ); |
|
5877 itemView->scrollTo( *modelIndex, static_cast< QAbstractItemView::ScrollHint >( aScrollHint ) ); |
|
5878 } |
|
5879 SWT_CATCH |
|
5880 } |
|
5881 |
|
5882 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1clearSelection ) |
|
5883 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
5884 { |
|
5885 SWT_TRY |
|
5886 { |
|
5887 SWT_LOG_JNI_CALL(); |
|
5888 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
5889 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5890 itemView->clearSelection(); |
|
5891 } |
|
5892 SWT_CATCH |
|
5893 } |
|
5894 |
|
5895 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1selectAll ) |
|
5896 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
5897 { |
|
5898 SWT_TRY |
|
5899 { |
|
5900 SWT_LOG_JNI_CALL(); |
|
5901 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
5902 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5903 itemView->selectAll(); |
|
5904 } |
|
5905 SWT_CATCH |
|
5906 } |
|
5907 |
|
5908 |
|
5909 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1setIconSize ) |
|
5910 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
5911 { |
|
5912 SWT_TRY |
|
5913 { |
|
5914 SWT_LOG_JNI_CALL(); |
|
5915 SWT_LOG_DATA_3("handle=%x x=%d y=%d", aHandle, aX, aY ); |
|
5916 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5917 itemView->setIconSize(QSize(aX,aY)); |
|
5918 } |
|
5919 SWT_CATCH |
|
5920 } |
|
5921 |
|
5922 JNIEXPORT jobject JNICALL OS_NATIVE( QAbstractItemView_1iconSize ) |
|
5923 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
5924 { |
|
5925 jobject javaPoint( NULL ); |
|
5926 SWT_TRY |
|
5927 { |
|
5928 SWT_LOG_JNI_CALL(); |
|
5929 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
5930 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5931 QSize size = itemView->iconSize(); |
|
5932 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
5933 } |
|
5934 SWT_CATCH |
|
5935 return javaPoint; |
|
5936 } |
|
5937 |
|
5938 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemView_1sizeHintForColumn ) |
|
5939 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn ) |
|
5940 { |
|
5941 jint sizeHint = 0; |
|
5942 SWT_TRY |
|
5943 { |
|
5944 SWT_LOG_JNI_CALL(); |
|
5945 SWT_LOG_DATA_2( "handle=%x column=%d", aHandle, aColumn ); |
|
5946 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5947 sizeHint = itemView->sizeHintForColumn( aColumn ); |
|
5948 } |
|
5949 SWT_CATCH |
|
5950 return sizeHint; |
|
5951 } |
|
5952 |
|
5953 JNIEXPORT jobject JNICALL OS_NATIVE( QAbstractItemView_1sizeHintForIndex ) |
|
5954 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aColumn ) |
|
5955 { |
|
5956 jobject javaPoint = NULL; |
|
5957 SWT_TRY |
|
5958 { |
|
5959 SWT_LOG_JNI_CALL(); |
|
5960 SWT_LOG_DATA_3( "handle=%x row=%d column=%d", aHandle, aRow, aColumn ); |
|
5961 HANDLE_TO_POINTER( QAbstractItemView*, widget, aHandle ); |
|
5962 QModelIndex* modelIndex = new QModelIndex( widget->model()->index( aRow, aColumn ) ); |
|
5963 QSize size( widget->sizeHintForIndex( *modelIndex ) ); |
|
5964 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, size ); |
|
5965 delete modelIndex; |
|
5966 } |
|
5967 SWT_CATCH |
|
5968 return javaPoint; |
|
5969 } |
|
5970 |
|
5971 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemView_1sizeHintForRow ) |
|
5972 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow ) |
|
5973 { |
|
5974 jint height = 0; |
|
5975 SWT_TRY |
|
5976 { |
|
5977 SWT_LOG_JNI_CALL(); |
|
5978 SWT_LOG_DATA_2("handle=%x row=%d", aHandle, aRow ); |
|
5979 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5980 height = itemView->sizeHintForRow( aRow ); |
|
5981 } |
|
5982 SWT_CATCH |
|
5983 return height; |
|
5984 } |
|
5985 |
|
5986 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemView_1swt_1indexAt ) |
|
5987 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY ) |
|
5988 { |
|
5989 jint res = 0; |
|
5990 SWT_TRY |
|
5991 { |
|
5992 SWT_LOG_JNI_CALL(); |
|
5993 SWT_LOG_DATA_3("handle=%x x=%d y=%d", aHandle, aX, aY ); |
|
5994 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
5995 res = itemView->indexAt( QPoint( aX, aY ) ).row(); |
|
5996 } |
|
5997 SWT_CATCH |
|
5998 return res; |
|
5999 } |
|
6000 |
|
6001 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1swt_1removeRows ) |
|
6002 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aRow, jint aCount) |
|
6003 { |
|
6004 SWT_TRY |
|
6005 { |
|
6006 SWT_LOG_JNI_CALL(); |
|
6007 SWT_LOG_DATA_3("handle=%x row=%d count=%d", aHandle, aRow, aCount ); |
|
6008 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
6009 QAbstractItemModel* model = itemView->model(); |
|
6010 model->removeRows(aRow, aCount); |
|
6011 } |
|
6012 SWT_CATCH |
|
6013 } |
|
6014 |
|
6015 JNIEXPORT void JNICALL OS_NATIVE( QAbstractItemView_1update ) |
|
6016 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndexHandle ) |
|
6017 { |
|
6018 SWT_TRY |
|
6019 { |
|
6020 SWT_LOG_JNI_CALL(); |
|
6021 SWT_LOG_DATA_2("handle=%x aIndex=%x ", aHandle, aIndexHandle ); |
|
6022 HANDLE_TO_POINTER( QAbstractItemView*, itemView, aHandle ); |
|
6023 QModelIndex* modelIndex = reinterpret_cast< QModelIndex* > ( aIndexHandle ); |
|
6024 itemView->update( *modelIndex ); |
|
6025 } |
|
6026 SWT_CATCH |
|
6027 } |
|
6028 |
|
6029 JNIEXPORT jobject JNICALL OS_NATIVE( QAbstractItemView_1visualRect ) |
|
6030 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aColumn ) |
|
6031 { |
|
6032 jobject javaRect = NULL; |
|
6033 SWT_TRY |
|
6034 { |
|
6035 SWT_LOG_JNI_CALL(); |
|
6036 SWT_LOG_DATA_3( "handle=%x row=%d column=%d", aHandle, aRow, aColumn ); |
|
6037 HANDLE_TO_POINTER( QAbstractItemView*, widget, aHandle ); |
|
6038 QModelIndex* modelIndex = new QModelIndex( widget->model()->index( aRow, aColumn ) ); |
|
6039 QRect rect( widget->visualRect( *modelIndex ) ); |
|
6040 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
6041 delete modelIndex; |
|
6042 } |
|
6043 SWT_CATCH |
|
6044 return javaRect; |
|
6045 } |
|
6046 |
|
6047 JNIEXPORT jint JNICALL OS_NATIVE( QAbstractItemView_1currentIndex ) |
|
6048 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6049 { |
|
6050 jint currentIndex = 0; |
|
6051 SWT_TRY |
|
6052 { |
|
6053 SWT_LOG_JNI_CALL(); |
|
6054 SWT_LOG_DATA_1( "handle=%x ", aHandle ); |
|
6055 HANDLE_TO_POINTER( QAbstractItemView*, widget, aHandle ); |
|
6056 currentIndex = widget->currentIndex().row(); |
|
6057 } |
|
6058 SWT_CATCH |
|
6059 return currentIndex; |
|
6060 } |
|
6061 |
|
6062 // |
|
6063 // QListView |
|
6064 // |
|
6065 |
|
6066 JNIEXPORT jint JNICALL OS_NATIVE( QListView_1new ) |
|
6067 ( JNIEnv* aJniEnv , jclass ) |
|
6068 { |
|
6069 QListView* listView( NULL ); |
|
6070 SWT_TRY |
|
6071 { |
|
6072 SWT_LOG_JNI_CALL(); |
|
6073 listView= new QListView(); |
|
6074 } |
|
6075 SWT_CATCH |
|
6076 return POINTER_TO_HANDLE( listView ); |
|
6077 } |
|
6078 |
|
6079 JNIEXPORT jint JNICALL OS_NATIVE( QListView_1flow ) |
|
6080 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6081 { |
|
6082 jint res = 0; |
|
6083 SWT_TRY |
|
6084 { |
|
6085 SWT_LOG_JNI_CALL(); |
|
6086 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
6087 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6088 res = listView->flow(); |
|
6089 } |
|
6090 SWT_CATCH |
|
6091 return res; |
|
6092 } |
|
6093 |
|
6094 JNIEXPORT jobject JNICALL OS_NATIVE( QListView_1gridSize ) |
|
6095 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6096 { |
|
6097 jobject javaPoint = NULL; |
|
6098 SWT_TRY |
|
6099 { |
|
6100 SWT_LOG_JNI_CALL(); |
|
6101 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
6102 HANDLE_TO_POINTER( QListView*, widget, aHandle ); |
|
6103 javaPoint = swtApp->jniUtils().NewJavaPoint( aJniEnv, widget->gridSize() ); |
|
6104 } |
|
6105 SWT_CATCH |
|
6106 return javaPoint; |
|
6107 } |
|
6108 |
|
6109 JNIEXPORT jint JNICALL OS_NATIVE( QListView_1resizeMode ) |
|
6110 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6111 { |
|
6112 jint res = 0; |
|
6113 SWT_TRY |
|
6114 { |
|
6115 SWT_LOG_JNI_CALL(); |
|
6116 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
6117 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6118 res = listView->resizeMode(); |
|
6119 } |
|
6120 SWT_CATCH |
|
6121 return res; |
|
6122 } |
|
6123 |
|
6124 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setFlow ) |
|
6125 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aFlow ) |
|
6126 { |
|
6127 SWT_TRY |
|
6128 { |
|
6129 SWT_LOG_JNI_CALL(); |
|
6130 SWT_LOG_DATA_2("handle=%x value=%x ", aHandle, aFlow ); |
|
6131 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6132 listView->setFlow( static_cast<QListView::Flow>(aFlow) ); |
|
6133 } |
|
6134 SWT_CATCH |
|
6135 } |
|
6136 |
|
6137 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setItemDelegate ) |
|
6138 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aDelegateHandle ) |
|
6139 { |
|
6140 SWT_TRY |
|
6141 { |
|
6142 SWT_LOG_JNI_CALL(); |
|
6143 SWT_LOG_DATA_2("handle=%x delegateHandle=%x ", aHandle, aDelegateHandle ); |
|
6144 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6145 HANDLE_TO_POINTER( QAbstractItemDelegate*, itemDelegate, aDelegateHandle ); |
|
6146 listView->setItemDelegate( itemDelegate ); |
|
6147 } |
|
6148 SWT_CATCH |
|
6149 } |
|
6150 |
|
6151 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setMovement ) |
|
6152 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aMovement ) |
|
6153 { |
|
6154 SWT_TRY |
|
6155 { |
|
6156 SWT_LOG_JNI_CALL(); |
|
6157 SWT_LOG_DATA_2( "handle=%x value=%x", aHandle, aMovement ); |
|
6158 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6159 listView->setMovement( static_cast<QListView::Movement>( aMovement ) ); |
|
6160 } |
|
6161 SWT_CATCH |
|
6162 } |
|
6163 |
|
6164 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setViewMode ) |
|
6165 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aViewMode ) |
|
6166 { |
|
6167 SWT_TRY |
|
6168 { |
|
6169 SWT_LOG_JNI_CALL(); |
|
6170 SWT_LOG_DATA_2( "handle=%x value=%x", aHandle, aViewMode ); |
|
6171 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6172 listView->setViewMode( static_cast<QListView::ViewMode>( aViewMode ) ); |
|
6173 } |
|
6174 SWT_CATCH |
|
6175 } |
|
6176 |
|
6177 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setGridSize ) |
|
6178 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight ) |
|
6179 { |
|
6180 SWT_TRY |
|
6181 { |
|
6182 SWT_LOG_JNI_CALL(); |
|
6183 SWT_LOG_DATA_3( "handle=%x width=%d height=%d", aHandle, aWidth, aHeight ); |
|
6184 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6185 listView->setGridSize( QSize( aWidth, aHeight ) ); |
|
6186 } |
|
6187 SWT_CATCH |
|
6188 } |
|
6189 |
|
6190 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setSpacing ) |
|
6191 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aSpacing ) |
|
6192 { |
|
6193 SWT_TRY |
|
6194 { |
|
6195 SWT_LOG_JNI_CALL(); |
|
6196 SWT_LOG_DATA_2( "handle=%x value=%d", aHandle, aSpacing ); |
|
6197 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6198 listView->setSpacing( aSpacing ); |
|
6199 } |
|
6200 SWT_CATCH |
|
6201 } |
|
6202 |
|
6203 JNIEXPORT void JNICALL OS_NATIVE( QListView_1setResizeMode ) |
|
6204 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode ) |
|
6205 { |
|
6206 SWT_TRY |
|
6207 { |
|
6208 SWT_LOG_JNI_CALL(); |
|
6209 SWT_LOG_DATA_2( "handle=%x value=%d", aHandle, aMode ); |
|
6210 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6211 listView->setResizeMode( static_cast<QListView::ResizeMode>(aMode) ); |
|
6212 } |
|
6213 SWT_CATCH |
|
6214 } |
|
6215 |
|
6216 JNIEXPORT jint JNICALL OS_NATIVE( QListView_1spacing ) |
|
6217 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6218 { |
|
6219 jint res = 0; |
|
6220 SWT_TRY |
|
6221 { |
|
6222 SWT_LOG_JNI_CALL(); |
|
6223 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
6224 HANDLE_TO_POINTER( QListView*, listView, aHandle ); |
|
6225 res = listView->spacing(); |
|
6226 } |
|
6227 SWT_CATCH |
|
6228 return res; |
|
6229 } |
|
6230 |
|
6231 // |
|
6232 //QModelIndexList |
|
6233 // |
|
6234 |
|
6235 JNIEXPORT jint JNICALL OS_NATIVE( QModelIndexList_1size ) |
|
6236 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6237 { |
|
6238 jint size = 0; |
|
6239 SWT_TRY |
|
6240 { |
|
6241 SWT_LOG_JNI_CALL(); |
|
6242 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
6243 //HANDLE_TO_POINTER( QList*, list, aHandle ); |
|
6244 QModelIndexList* list = reinterpret_cast < QModelIndexList* > ( aHandle ); |
|
6245 size = list->size(); |
|
6246 } |
|
6247 SWT_CATCH |
|
6248 return size; |
|
6249 } |
|
6250 |
|
6251 JNIEXPORT jint JNICALL OS_NATIVE( QModelIndexList_1at ) |
|
6252 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
6253 { |
|
6254 const QModelIndex* modelIndex( NULL ); |
|
6255 SWT_TRY |
|
6256 { |
|
6257 SWT_LOG_JNI_CALL(); |
|
6258 SWT_LOG_DATA_2("handle=%x index=%d ", aHandle, aIndex); |
|
6259 QModelIndexList* list = reinterpret_cast < QModelIndexList* > ( aHandle ); |
|
6260 modelIndex = &list->at( aIndex ); |
|
6261 } |
|
6262 SWT_CATCH |
|
6263 return reinterpret_cast < jint > ( modelIndex ); |
|
6264 } |
|
6265 |
|
6266 |
|
6267 |
|
6268 // |
|
6269 //QKeySequence |
|
6270 // |
|
6271 JNIEXPORT jint JNICALL OS_NATIVE( QKeySequence_1new ) |
|
6272 ( JNIEnv* aJniEnv , jclass, jint aInteger ) |
|
6273 { |
|
6274 QKeySequence* keySequence = NULL; |
|
6275 SWT_TRY |
|
6276 { |
|
6277 SWT_LOG_JNI_CALL(); |
|
6278 SWT_LOG_DATA_1("aInteger=%x", aInteger); |
|
6279 keySequence = new QKeySequence( aInteger ); |
|
6280 } |
|
6281 SWT_CATCH |
|
6282 return reinterpret_cast< jint >( static_cast< QKeySequence* >( keySequence ) ); |
|
6283 } |
|
6284 |
|
6285 JNIEXPORT void JNICALL OS_NATIVE( QKeySequence_1delete ) |
|
6286 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6287 { |
|
6288 SWT_TRY |
|
6289 { |
|
6290 SWT_LOG_JNI_CALL(); |
|
6291 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6292 QKeySequence* keySequence = reinterpret_cast< QKeySequence* >( aHandle ); |
|
6293 delete keySequence; |
|
6294 keySequence = NULL; |
|
6295 } |
|
6296 SWT_CATCH |
|
6297 } |
|
6298 // |
|
6299 //QIcon |
|
6300 // |
|
6301 JNIEXPORT jint JNICALL OS_NATIVE( QIcon_1new__I ) |
|
6302 ( JNIEnv* aJniEnv , jclass, jint aPixmap ) |
|
6303 { |
|
6304 QIcon* icon = NULL; |
|
6305 SWT_TRY |
|
6306 { |
|
6307 SWT_LOG_JNI_CALL(); |
|
6308 SWT_LOG_DATA_1("aPixmap=%x", aPixmap); |
|
6309 QPixmap* pixmap = reinterpret_cast< QPixmap* >( aPixmap ); |
|
6310 icon = new QIcon( *pixmap ); |
|
6311 } |
|
6312 SWT_CATCH |
|
6313 return reinterpret_cast< jint >( static_cast< QIcon* >( icon ) ); |
|
6314 } |
|
6315 |
|
6316 JNIEXPORT jint JNICALL OS_NATIVE ( QIcon_1new__ ) |
|
6317 (JNIEnv* aJniEnv , jclass) |
|
6318 { |
|
6319 QIcon* icon = NULL; |
|
6320 SWT_TRY |
|
6321 { |
|
6322 SWT_LOG_JNI_CALL(); |
|
6323 icon = new QIcon(); |
|
6324 } |
|
6325 SWT_CATCH |
|
6326 return reinterpret_cast< jint >( static_cast< QIcon* >( icon ) ); |
|
6327 } |
|
6328 |
|
6329 JNIEXPORT void JNICALL OS_NATIVE( QIcon_1delete ) |
|
6330 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6331 { |
|
6332 SWT_TRY |
|
6333 { |
|
6334 SWT_LOG_JNI_CALL(); |
|
6335 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6336 QIcon* icon = reinterpret_cast< QIcon* >( aHandle ); |
|
6337 delete icon; |
|
6338 icon = NULL; |
|
6339 } |
|
6340 SWT_CATCH |
|
6341 |
|
6342 } |
|
6343 |
|
6344 JNIEXPORT jint JNICALL OS_NATIVE( QIcon_1pixmap ) |
|
6345 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight) |
|
6346 { |
|
6347 QPixmap* pixmap = NULL; |
|
6348 SWT_TRY |
|
6349 { |
|
6350 SWT_LOG_JNI_CALL(); |
|
6351 SWT_LOG_DATA_3("handle=%x width=%d height=%d", aHandle, aWidth, aHeight); |
|
6352 QIcon* icon = reinterpret_cast< QIcon* >( aHandle ); |
|
6353 pixmap = new QPixmap(icon->pixmap(aWidth, aHeight)); |
|
6354 } |
|
6355 SWT_CATCH |
|
6356 return reinterpret_cast< jint >(pixmap); |
|
6357 } |
|
6358 |
|
6359 |
|
6360 |
|
6361 // |
|
6362 // QSlider |
|
6363 // |
|
6364 |
|
6365 JNIEXPORT jint JNICALL OS_NATIVE( QSlider_1new ) |
|
6366 (JNIEnv* aJniEnv , jclass) |
|
6367 { |
|
6368 QSlider* slider = NULL; |
|
6369 SWT_TRY |
|
6370 { |
|
6371 SWT_LOG_JNI_CALL(); |
|
6372 slider = new QSlider(); |
|
6373 } |
|
6374 SWT_CATCH |
|
6375 return POINTER_TO_HANDLE( slider ); |
|
6376 } |
|
6377 |
|
6378 JNIEXPORT jint JNICALL OS_NATIVE( QSlider_1singleStep ) |
|
6379 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6380 { |
|
6381 jint singleStep = -1; |
|
6382 SWT_TRY |
|
6383 { |
|
6384 SWT_LOG_JNI_CALL(); |
|
6385 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6386 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6387 singleStep = slider->singleStep(); |
|
6388 } |
|
6389 SWT_CATCH |
|
6390 return singleStep; |
|
6391 } |
|
6392 |
|
6393 JNIEXPORT jint JNICALL OS_NATIVE( QSlider_1maximum ) |
|
6394 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6395 { |
|
6396 jint maximum = -1; |
|
6397 SWT_TRY |
|
6398 { |
|
6399 SWT_LOG_JNI_CALL(); |
|
6400 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6401 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6402 maximum = slider->maximum(); |
|
6403 } |
|
6404 SWT_CATCH |
|
6405 return maximum; |
|
6406 } |
|
6407 |
|
6408 |
|
6409 JNIEXPORT jint JNICALL OS_NATIVE( QSlider_1minimum ) |
|
6410 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6411 { |
|
6412 jint minimum = -1; |
|
6413 SWT_TRY |
|
6414 { |
|
6415 SWT_LOG_JNI_CALL(); |
|
6416 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6417 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6418 minimum = slider->minimum(); |
|
6419 } |
|
6420 SWT_CATCH |
|
6421 return minimum; |
|
6422 } |
|
6423 |
|
6424 JNIEXPORT jint JNICALL OS_NATIVE( QSlider_1pageStep ) |
|
6425 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6426 { |
|
6427 jint pageStep = -1; |
|
6428 SWT_TRY |
|
6429 { |
|
6430 SWT_LOG_JNI_CALL(); |
|
6431 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6432 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6433 pageStep = slider->pageStep(); |
|
6434 } |
|
6435 SWT_CATCH |
|
6436 return pageStep; |
|
6437 } |
|
6438 |
|
6439 JNIEXPORT jint JNICALL OS_NATIVE( QSlider_1value ) |
|
6440 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6441 { |
|
6442 jint value = -1; |
|
6443 SWT_TRY |
|
6444 { |
|
6445 SWT_LOG_JNI_CALL(); |
|
6446 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6447 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6448 value = slider->value(); |
|
6449 } |
|
6450 SWT_CATCH |
|
6451 return value; |
|
6452 } |
|
6453 |
|
6454 JNIEXPORT void JNICALL OS_NATIVE( QSlider_1setSingleStep ) |
|
6455 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6456 { |
|
6457 SWT_TRY |
|
6458 { |
|
6459 SWT_LOG_JNI_CALL(); |
|
6460 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6461 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6462 slider->setSingleStep( aValue ); |
|
6463 } |
|
6464 SWT_CATCH |
|
6465 } |
|
6466 |
|
6467 JNIEXPORT void JNICALL OS_NATIVE( QSlider_1setMaximum ) |
|
6468 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6469 { |
|
6470 SWT_TRY |
|
6471 { |
|
6472 SWT_LOG_JNI_CALL(); |
|
6473 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6474 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6475 slider->setMaximum( aValue ); |
|
6476 } |
|
6477 SWT_CATCH |
|
6478 } |
|
6479 |
|
6480 |
|
6481 JNIEXPORT void JNICALL OS_NATIVE( QSlider_1setMinimum ) |
|
6482 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6483 { |
|
6484 SWT_TRY |
|
6485 { |
|
6486 SWT_LOG_JNI_CALL(); |
|
6487 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6488 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6489 slider->setMinimum( aValue ); |
|
6490 } |
|
6491 SWT_CATCH |
|
6492 } |
|
6493 |
|
6494 |
|
6495 JNIEXPORT void JNICALL OS_NATIVE( QSlider_1setPageStep ) |
|
6496 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6497 { |
|
6498 SWT_TRY |
|
6499 { |
|
6500 SWT_LOG_JNI_CALL(); |
|
6501 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6502 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6503 slider->setPageStep( aValue ); |
|
6504 } |
|
6505 SWT_CATCH |
|
6506 } |
|
6507 |
|
6508 |
|
6509 JNIEXPORT void JNICALL OS_NATIVE( QSlider_1setValue ) |
|
6510 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6511 { |
|
6512 SWT_TRY |
|
6513 { |
|
6514 SWT_LOG_JNI_CALL(); |
|
6515 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6516 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6517 slider->setValue( aValue ); |
|
6518 } |
|
6519 SWT_CATCH |
|
6520 } |
|
6521 |
|
6522 JNIEXPORT void JNICALL OS_NATIVE( QSlider_1setOrientation ) |
|
6523 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6524 { |
|
6525 SWT_TRY |
|
6526 { |
|
6527 SWT_LOG_JNI_CALL(); |
|
6528 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6529 HANDLE_TO_POINTER( QSlider*, slider, aHandle ); |
|
6530 slider->setOrientation( static_cast<Qt::Orientation>( aValue ) ); |
|
6531 } |
|
6532 SWT_CATCH |
|
6533 } |
|
6534 |
|
6535 // |
|
6536 // QColor |
|
6537 // |
|
6538 |
|
6539 JNIEXPORT jint JNICALL OS_NATIVE( QColor_1new__ ) |
|
6540 (JNIEnv* aJniEnv , jclass) |
|
6541 { |
|
6542 QColor* color = NULL; |
|
6543 SWT_TRY |
|
6544 { |
|
6545 SWT_LOG_JNI_CALL(); |
|
6546 color = new QColor(); |
|
6547 } |
|
6548 SWT_CATCH |
|
6549 return QCOLOR_TO_HANDLE( color ); |
|
6550 } |
|
6551 |
|
6552 JNIEXPORT jint JNICALL OS_NATIVE( QColor_1new__III ) |
|
6553 (JNIEnv* aJniEnv , jclass, jint aRed, jint aGreen, jint aBlue) |
|
6554 { |
|
6555 const int& red = static_cast<int>(aRed); |
|
6556 const int& green = static_cast<int>(aGreen); |
|
6557 const int& blue = static_cast<int>(aBlue); |
|
6558 QColor* color = NULL; |
|
6559 SWT_TRY |
|
6560 { |
|
6561 SWT_LOG_JNI_CALL(); |
|
6562 color = new QColor(red, green, blue); |
|
6563 } |
|
6564 SWT_CATCH |
|
6565 return QCOLOR_TO_HANDLE( color ); |
|
6566 } |
|
6567 |
|
6568 JNIEXPORT jint JNICALL OS_NATIVE( QColor_1red ) |
|
6569 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6570 { |
|
6571 jint red = -1; |
|
6572 SWT_TRY |
|
6573 { |
|
6574 SWT_LOG_JNI_CALL(); |
|
6575 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6576 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6577 red = color->red(); |
|
6578 } |
|
6579 SWT_CATCH |
|
6580 return red; |
|
6581 } |
|
6582 |
|
6583 JNIEXPORT jint JNICALL OS_NATIVE( QColor_1green ) |
|
6584 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6585 { |
|
6586 jint green = -1; |
|
6587 SWT_TRY |
|
6588 { |
|
6589 SWT_LOG_JNI_CALL(); |
|
6590 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6591 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6592 green = color->green(); |
|
6593 } |
|
6594 SWT_CATCH |
|
6595 return green; |
|
6596 } |
|
6597 |
|
6598 JNIEXPORT jint JNICALL OS_NATIVE( QColor_1blue ) |
|
6599 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6600 { |
|
6601 jint blue = -1; |
|
6602 SWT_TRY |
|
6603 { |
|
6604 SWT_LOG_JNI_CALL(); |
|
6605 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6606 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6607 blue = color->blue(); |
|
6608 } |
|
6609 SWT_CATCH |
|
6610 return blue; |
|
6611 } |
|
6612 |
|
6613 JNIEXPORT void JNICALL OS_NATIVE( QColor_1setRed ) |
|
6614 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6615 { |
|
6616 SWT_TRY |
|
6617 { |
|
6618 SWT_LOG_JNI_CALL(); |
|
6619 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6620 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6621 color->setRed( aValue ); |
|
6622 } |
|
6623 SWT_CATCH |
|
6624 } |
|
6625 |
|
6626 |
|
6627 JNIEXPORT void JNICALL OS_NATIVE( QColor_1setGreen ) |
|
6628 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6629 { |
|
6630 SWT_TRY |
|
6631 { |
|
6632 SWT_LOG_JNI_CALL(); |
|
6633 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6634 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6635 color->setGreen( aValue ); |
|
6636 } |
|
6637 SWT_CATCH |
|
6638 } |
|
6639 |
|
6640 |
|
6641 JNIEXPORT void JNICALL OS_NATIVE( QColor_1setBlue ) |
|
6642 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
6643 { |
|
6644 SWT_TRY |
|
6645 { |
|
6646 SWT_LOG_JNI_CALL(); |
|
6647 SWT_LOG_DATA_2("handle=%x value=%x", aHandle, aValue ); |
|
6648 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6649 color->setBlue( aValue ); |
|
6650 } |
|
6651 SWT_CATCH |
|
6652 } |
|
6653 |
|
6654 JNIEXPORT void JNICALL OS_NATIVE( QColor_1delete ) |
|
6655 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6656 { |
|
6657 SWT_TRY |
|
6658 { |
|
6659 SWT_LOG_JNI_CALL(); |
|
6660 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
6661 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6662 delete color; |
|
6663 color = NULL; |
|
6664 } |
|
6665 SWT_CATCH |
|
6666 } |
|
6667 |
|
6668 JNIEXPORT jboolean JNICALL OS_NATIVE( QColor_1equals ) |
|
6669 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aCompareHandle) |
|
6670 { |
|
6671 jboolean result = false; |
|
6672 SWT_TRY |
|
6673 { |
|
6674 SWT_LOG_JNI_CALL(); |
|
6675 SWT_LOG_DATA_2("handle1=%x handle2=%x", aHandle, aCompareHandle); |
|
6676 HANDLE_TO_QCOLOR( color1, aHandle ); |
|
6677 HANDLE_TO_QCOLOR( color2, aCompareHandle ); |
|
6678 result = (*color1 == *color2); |
|
6679 } |
|
6680 SWT_CATCH |
|
6681 return result; |
|
6682 } |
|
6683 |
|
6684 JNIEXPORT jboolean JNICALL OS_NATIVE( QColor_1isValid) |
|
6685 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
6686 { |
|
6687 jboolean result = false; |
|
6688 SWT_TRY |
|
6689 { |
|
6690 SWT_LOG_JNI_CALL(); |
|
6691 SWT_LOG_DATA_1("handle1=%x ", aHandle); |
|
6692 HANDLE_TO_QCOLOR( color, aHandle ); |
|
6693 result = color->isValid(); |
|
6694 } |
|
6695 SWT_CATCH |
|
6696 return result; |
|
6697 } |
|
6698 // |
|
6699 //QColorDialog |
|
6700 // |
|
6701 JNIEXPORT jint JNICALL OS_NATIVE( QColorDialog_1getColor ) |
|
6702 (JNIEnv* aJniEnv , jclass, jint aColorHandle, jint aParentHandle, jstring aDialogID, jint aLayoutDirection ) |
|
6703 { |
|
6704 QColor* color = NULL; |
|
6705 SWT_TRY |
|
6706 { |
|
6707 SWT_LOG_JNI_CALL(); |
|
6708 SWT_LOG_DATA_3("colorHandle=%x parentHandle=%x layoutDirection=%d", aColorHandle, aParentHandle, aLayoutDirection); |
|
6709 HANDLE_TO_QCOLOR( initialColor, aColorHandle ); |
|
6710 HANDLE_TO_POINTER( QWidget*, parent, aParentHandle ); |
|
6711 QColorDialog dialog( *initialColor, parent ); |
|
6712 dialog.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID) ); |
|
6713 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
6714 AutoPopExecStack stackExec(&dialog); |
|
6715 int code = dialog.exec(); |
|
6716 if( code == QDialog::Accepted ) |
|
6717 { |
|
6718 color = new QColor( dialog.selectedColor() ); |
|
6719 } |
|
6720 } |
|
6721 SWT_CATCH |
|
6722 return QCOLOR_TO_HANDLE( color ); |
|
6723 } |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 // |
|
6729 // QTableWidget |
|
6730 // |
|
6731 |
|
6732 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1new ) |
|
6733 (JNIEnv* aJniEnv , jclass) |
|
6734 { |
|
6735 QTableWidget* table = NULL; |
|
6736 SWT_TRY |
|
6737 { |
|
6738 SWT_LOG_JNI_CALL(); |
|
6739 table = new QTableWidget(); |
|
6740 table->setWordWrap( false ); |
|
6741 } |
|
6742 SWT_CATCH |
|
6743 return POINTER_TO_HANDLE( table ); |
|
6744 } |
|
6745 |
|
6746 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1clearContents ) |
|
6747 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
6748 { |
|
6749 SWT_TRY |
|
6750 { |
|
6751 SWT_LOG_JNI_CALL(); |
|
6752 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6753 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6754 table->clearContents(); |
|
6755 } |
|
6756 SWT_CATCH |
|
6757 } |
|
6758 |
|
6759 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1rowCount ) |
|
6760 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6761 { |
|
6762 jint rowCount = 0; |
|
6763 SWT_TRY |
|
6764 { |
|
6765 SWT_LOG_JNI_CALL(); |
|
6766 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6767 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6768 rowCount = table->rowCount(); |
|
6769 } |
|
6770 SWT_CATCH |
|
6771 return rowCount; |
|
6772 } |
|
6773 |
|
6774 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1columnCount ) |
|
6775 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6776 { |
|
6777 jint columnCount = 0; |
|
6778 SWT_TRY |
|
6779 { |
|
6780 SWT_LOG_JNI_CALL(); |
|
6781 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6782 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6783 columnCount = table->columnCount(); |
|
6784 } |
|
6785 SWT_CATCH |
|
6786 return columnCount; |
|
6787 } |
|
6788 |
|
6789 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1swt_1headerHeight ) |
|
6790 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aHorizontalHeader) |
|
6791 { |
|
6792 jint height = 0; |
|
6793 SWT_TRY |
|
6794 { |
|
6795 SWT_LOG_JNI_CALL(); |
|
6796 SWT_LOG_DATA_2("handle=%x horizontalHeader=%d", aHandle, aHorizontalHeader); |
|
6797 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6798 if (aHorizontalHeader) |
|
6799 { |
|
6800 height = table->horizontalHeader()->height(); |
|
6801 } |
|
6802 else |
|
6803 { |
|
6804 height = table->verticalHeader()->height(); |
|
6805 } |
|
6806 } |
|
6807 SWT_CATCH |
|
6808 return height; |
|
6809 } |
|
6810 |
|
6811 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1column ) |
|
6812 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumnHandle) |
|
6813 { |
|
6814 jint column = 0; |
|
6815 SWT_TRY |
|
6816 { |
|
6817 SWT_LOG_JNI_CALL(); |
|
6818 SWT_LOG_DATA_2("handle=%x columnHandle=%x", aHandle, aColumnHandle); |
|
6819 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6820 HANDLE_TO_QTABLEWIDGETITEM( item, aColumnHandle ); |
|
6821 column = table->column( item ); |
|
6822 } |
|
6823 SWT_CATCH |
|
6824 return column; |
|
6825 } |
|
6826 |
|
6827 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1row ) |
|
6828 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRowHandle) |
|
6829 { |
|
6830 jint row = 0; |
|
6831 SWT_TRY |
|
6832 { |
|
6833 SWT_LOG_JNI_CALL(); |
|
6834 SWT_LOG_DATA_2("handle=%x rowHandle=%x", aHandle, aRowHandle); |
|
6835 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6836 HANDLE_TO_QTABLEWIDGETITEM( item, aRowHandle ); |
|
6837 row = table->row( item ); |
|
6838 } |
|
6839 SWT_CATCH |
|
6840 return row; |
|
6841 } |
|
6842 |
|
6843 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1currentColumn ) |
|
6844 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6845 { |
|
6846 jint column = 0; |
|
6847 SWT_TRY |
|
6848 { |
|
6849 SWT_LOG_JNI_CALL(); |
|
6850 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6851 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6852 column = table->currentColumn(); |
|
6853 } |
|
6854 SWT_CATCH |
|
6855 return column; |
|
6856 } |
|
6857 |
|
6858 |
|
6859 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1currentRow ) |
|
6860 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6861 { |
|
6862 jint row = 0; |
|
6863 SWT_TRY |
|
6864 { |
|
6865 SWT_LOG_JNI_CALL(); |
|
6866 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6867 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6868 row = table->currentRow(); |
|
6869 } |
|
6870 SWT_CATCH |
|
6871 return row; |
|
6872 } |
|
6873 |
|
6874 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1swt_1selectionCount ) |
|
6875 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6876 { |
|
6877 jint count = 0; |
|
6878 SWT_TRY |
|
6879 { |
|
6880 SWT_LOG_JNI_CALL(); |
|
6881 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6882 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6883 QList<QTableWidgetItem*> items = table->selectedItems(); |
|
6884 |
|
6885 int itemCount = items.size(); |
|
6886 QSet<int> rows; |
|
6887 for(int i = 0; i < itemCount; ++i) |
|
6888 { |
|
6889 rows.insert(table->row(items.at(i))); |
|
6890 } |
|
6891 count = rows.size(); |
|
6892 } |
|
6893 SWT_CATCH |
|
6894 return count; |
|
6895 } |
|
6896 |
|
6897 |
|
6898 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1swt_1headerSize ) |
|
6899 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aHorizontalHeader, jint aIndex) |
|
6900 { |
|
6901 jint size = 0; |
|
6902 SWT_TRY |
|
6903 { |
|
6904 SWT_LOG_JNI_CALL(); |
|
6905 SWT_LOG_DATA_3("handle=%x horizontalHeader=%d index=%d", aHandle, aHorizontalHeader, aIndex); |
|
6906 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6907 if (aHorizontalHeader) |
|
6908 { |
|
6909 size = table->horizontalHeader()->sectionSize(aIndex); |
|
6910 } |
|
6911 else |
|
6912 { |
|
6913 size = table->verticalHeader()->sectionSize(aIndex); |
|
6914 } |
|
6915 } |
|
6916 SWT_CATCH |
|
6917 return size; |
|
6918 } |
|
6919 |
|
6920 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1topIndex ) |
|
6921 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6922 { |
|
6923 jint topIndex = 0; |
|
6924 SWT_TRY |
|
6925 { |
|
6926 SWT_LOG_JNI_CALL(); |
|
6927 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6928 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6929 topIndex = table->rowAt(1); |
|
6930 } |
|
6931 SWT_CATCH |
|
6932 return topIndex; |
|
6933 } |
|
6934 |
|
6935 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1swt_1header ) |
|
6936 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aHorizontalHeader) |
|
6937 { |
|
6938 jint header = 0; |
|
6939 SWT_TRY |
|
6940 { |
|
6941 SWT_LOG_JNI_CALL(); |
|
6942 SWT_LOG_DATA_2("handle=%x horizontalHeader=%d", aHandle, aHorizontalHeader); |
|
6943 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6944 if (aHorizontalHeader) |
|
6945 { |
|
6946 header = POINTER_TO_HANDLE( table->horizontalHeader() ); |
|
6947 } |
|
6948 else |
|
6949 { |
|
6950 header = POINTER_TO_HANDLE( table->horizontalHeader() ); |
|
6951 } |
|
6952 } |
|
6953 SWT_CATCH |
|
6954 return header; |
|
6955 } |
|
6956 |
|
6957 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1itemAt ) |
|
6958 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
6959 { |
|
6960 jint item = 0; |
|
6961 SWT_TRY |
|
6962 { |
|
6963 SWT_LOG_JNI_CALL(); |
|
6964 SWT_LOG_DATA_3("handle=%x x=%d y=%d", aHandle, aX, aY); |
|
6965 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6966 item = QTABLEWIDGETITEM_TO_HANDLE( table->itemAt( aX, aY ) ); |
|
6967 } |
|
6968 SWT_CATCH |
|
6969 return item; |
|
6970 } |
|
6971 |
|
6972 JNIEXPORT jintArray JNICALL OS_NATIVE( QTableWidget_1swt_1selectedItems ) |
|
6973 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
6974 { |
|
6975 jintArray javaArray = NULL; |
|
6976 SWT_TRY |
|
6977 { |
|
6978 SWT_LOG_JNI_CALL(); |
|
6979 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
6980 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
6981 QList<QTableWidgetItem*> items = table->selectedItems(); |
|
6982 |
|
6983 int itemCount = items.size(); |
|
6984 QSet<int> rows; |
|
6985 for(int i = 0; i < itemCount; ++i) |
|
6986 { |
|
6987 rows.insert(table->row(items.at(i))); |
|
6988 } |
|
6989 QList<int> rowList = rows.toList(); |
|
6990 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, rowList.toVector().data(), rows.size() ); |
|
6991 } |
|
6992 SWT_CATCH |
|
6993 return javaArray; |
|
6994 } |
|
6995 |
|
6996 |
|
6997 JNIEXPORT jboolean JNICALL OS_NATIVE( QTableWidget_1swt_1headerVisible ) |
|
6998 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aHorizontalHeader) |
|
6999 { |
|
7000 jboolean visible = false; |
|
7001 SWT_TRY |
|
7002 { |
|
7003 SWT_LOG_JNI_CALL(); |
|
7004 SWT_LOG_DATA_2("handle=%x horizontalHeader=%d", aHandle, aHorizontalHeader); |
|
7005 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7006 if (aHorizontalHeader) |
|
7007 { |
|
7008 visible = !table->horizontalHeader()->isHidden(); |
|
7009 } |
|
7010 else |
|
7011 { |
|
7012 visible = !table->verticalHeader()->isHidden(); |
|
7013 } |
|
7014 } |
|
7015 SWT_CATCH |
|
7016 return visible; |
|
7017 } |
|
7018 |
|
7019 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1setCellWidget ) |
|
7020 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aColumn, jint aWidgetHandle) |
|
7021 { |
|
7022 SWT_TRY |
|
7023 { |
|
7024 SWT_LOG_JNI_CALL(); |
|
7025 SWT_LOG_DATA_4("handle=%x row=%d column=%d widgetHandle=%x", aHandle, aRow, aColumn, aWidgetHandle); |
|
7026 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7027 HANDLE_TO_POINTER( QWidget*,widget, aWidgetHandle ); |
|
7028 table->setCellWidget(aRow, aColumn, widget); |
|
7029 } |
|
7030 SWT_CATCH |
|
7031 } |
|
7032 |
|
7033 |
|
7034 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1setItem ) |
|
7035 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aColumn, jint aItemHandle) |
|
7036 { |
|
7037 SWT_TRY |
|
7038 { |
|
7039 SWT_LOG_JNI_CALL(); |
|
7040 SWT_LOG_DATA_4("handle=%x row=%d column=%d itemHandle=%x", aHandle, aRow, aColumn, aItemHandle); |
|
7041 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7042 HANDLE_TO_QTABLEWIDGETITEM( item, aItemHandle ); |
|
7043 table->setItem(aRow, aColumn, item); |
|
7044 } |
|
7045 SWT_CATCH |
|
7046 } |
|
7047 |
|
7048 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1setRowCount ) |
|
7049 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRowCount) |
|
7050 { |
|
7051 SWT_TRY |
|
7052 { |
|
7053 SWT_LOG_JNI_CALL(); |
|
7054 SWT_LOG_DATA_2("handle=%x rowCount=%d", aHandle, aRowCount); |
|
7055 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7056 table->setRowCount(aRowCount); |
|
7057 } |
|
7058 SWT_CATCH |
|
7059 } |
|
7060 |
|
7061 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1setColumnCount ) |
|
7062 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumnCount) |
|
7063 { |
|
7064 SWT_TRY |
|
7065 { |
|
7066 SWT_LOG_JNI_CALL(); |
|
7067 SWT_LOG_DATA_2("handle=%x columnCount=%d", aHandle, aColumnCount); |
|
7068 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7069 table->setColumnCount(aColumnCount); |
|
7070 } |
|
7071 SWT_CATCH |
|
7072 } |
|
7073 |
|
7074 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1insertRow ) |
|
7075 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow) |
|
7076 { |
|
7077 SWT_TRY |
|
7078 { |
|
7079 SWT_LOG_JNI_CALL(); |
|
7080 SWT_LOG_DATA_2("handle=%x row=%d", aHandle, aRow); |
|
7081 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7082 table->insertRow(aRow); |
|
7083 } |
|
7084 SWT_CATCH |
|
7085 } |
|
7086 |
|
7087 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1insertColumn ) |
|
7088 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn) |
|
7089 { |
|
7090 SWT_TRY |
|
7091 { |
|
7092 SWT_LOG_JNI_CALL(); |
|
7093 SWT_LOG_DATA_2("handle=%x column=%d", aHandle, aColumn); |
|
7094 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7095 table->insertColumn(aColumn); |
|
7096 } |
|
7097 SWT_CATCH |
|
7098 } |
|
7099 |
|
7100 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1removeRow ) |
|
7101 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow) |
|
7102 { |
|
7103 SWT_TRY |
|
7104 { |
|
7105 SWT_LOG_JNI_CALL(); |
|
7106 SWT_LOG_DATA_2("handle=%x row=%d", aHandle, aRow); |
|
7107 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7108 table->removeRow(aRow); |
|
7109 } |
|
7110 SWT_CATCH |
|
7111 } |
|
7112 |
|
7113 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1removeColumn ) |
|
7114 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn) |
|
7115 { |
|
7116 SWT_TRY |
|
7117 { |
|
7118 SWT_LOG_JNI_CALL(); |
|
7119 SWT_LOG_DATA_2("handle=%x column=%d", aHandle, aColumn); |
|
7120 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7121 table->removeColumn(aColumn); |
|
7122 } |
|
7123 SWT_CATCH |
|
7124 } |
|
7125 |
|
7126 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1swt_1setHeaderVisible ) |
|
7127 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aHorizontalHeader, jboolean aVisible) |
|
7128 { |
|
7129 SWT_TRY |
|
7130 { |
|
7131 SWT_LOG_JNI_CALL(); |
|
7132 SWT_LOG_DATA_3("handle=%x horizontalHeader=%d visible=%d", aHandle, aHorizontalHeader, aVisible); |
|
7133 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7134 if (aHorizontalHeader) |
|
7135 { |
|
7136 table->horizontalHeader()->setVisible(aVisible); |
|
7137 } |
|
7138 else |
|
7139 { |
|
7140 table->verticalHeader()->setVisible(aVisible); |
|
7141 } |
|
7142 } |
|
7143 SWT_CATCH |
|
7144 } |
|
7145 |
|
7146 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1swt_1setHeaderText ) |
|
7147 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn, jstring aText) |
|
7148 { |
|
7149 SWT_TRY |
|
7150 { |
|
7151 SWT_LOG_JNI_CALL(); |
|
7152 SWT_LOG_DATA_2("handle=%x column=%d", aHandle, aColumn); |
|
7153 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7154 QTableWidgetItem* item = table->horizontalHeaderItem(aColumn); |
|
7155 if (item == 0) |
|
7156 { |
|
7157 item = new QTableWidgetItem(); |
|
7158 } |
|
7159 item->setText(swtApp->jniUtils().JavaStringToQString( aJniEnv, aText )); |
|
7160 table->setHorizontalHeaderItem(aColumn, item); |
|
7161 } |
|
7162 SWT_CATCH |
|
7163 } |
|
7164 |
|
7165 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1scrollToItem ) |
|
7166 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle, jint aScrollHint) |
|
7167 { |
|
7168 SWT_TRY |
|
7169 { |
|
7170 SWT_LOG_JNI_CALL(); |
|
7171 SWT_LOG_DATA_2("handle=%x itemhandle=%x", aHandle, aItemHandle); |
|
7172 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7173 HANDLE_TO_QTABLEWIDGETITEM( item, aItemHandle ); |
|
7174 table->scrollToItem( item, static_cast<QAbstractItemView::ScrollHint>( aScrollHint ) ); |
|
7175 } |
|
7176 SWT_CATCH |
|
7177 } |
|
7178 |
|
7179 |
|
7180 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1swt_1setHeaderIcon ) |
|
7181 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jint aIconHandle) |
|
7182 { |
|
7183 SWT_TRY |
|
7184 { |
|
7185 SWT_LOG_JNI_CALL(); |
|
7186 SWT_LOG_DATA_3("handle=%x index=%d iconHandle=%d", aHandle, aIndex, aIconHandle); |
|
7187 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7188 QIcon* icon = reinterpret_cast<QIcon*>(aIconHandle); |
|
7189 QTableWidgetItem* item = table->horizontalHeaderItem(aIndex); |
|
7190 if (item == 0) |
|
7191 { |
|
7192 item = new QTableWidgetItem(); |
|
7193 } |
|
7194 item->setIcon(*icon); |
|
7195 table->setHorizontalHeaderItem(aIndex, item); |
|
7196 } |
|
7197 SWT_CATCH |
|
7198 } |
|
7199 |
|
7200 |
|
7201 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1swt_1resizeHeaderSection ) |
|
7202 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aHorizontalHeader, jint aIndex, jint aSize) |
|
7203 { |
|
7204 SWT_TRY |
|
7205 { |
|
7206 SWT_LOG_JNI_CALL(); |
|
7207 SWT_LOG_DATA_4("handle=%x horizontalHeader=%d index=%d size=%d", aHandle, aHorizontalHeader, aIndex, aSize); |
|
7208 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7209 if (aHorizontalHeader) |
|
7210 { |
|
7211 table->horizontalHeader()->resizeSection( aIndex, aSize ); |
|
7212 } |
|
7213 else |
|
7214 { |
|
7215 table->verticalHeader()->resizeSection( aIndex, aSize ); |
|
7216 } |
|
7217 } |
|
7218 SWT_CATCH |
|
7219 } |
|
7220 |
|
7221 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1setCurrentItem ) |
|
7222 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle) |
|
7223 { |
|
7224 SWT_TRY |
|
7225 { |
|
7226 SWT_LOG_JNI_CALL(); |
|
7227 SWT_LOG_DATA_2("handle=%x itemhandle=%x", aHandle, aItemHandle); |
|
7228 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7229 HANDLE_TO_QTABLEWIDGETITEM( item, aItemHandle ); |
|
7230 table->setCurrentItem( item ); |
|
7231 } |
|
7232 SWT_CATCH |
|
7233 } |
|
7234 |
|
7235 |
|
7236 JNIEXPORT jobject JNICALL OS_NATIVE( QTableWidget_1visualItemRect ) |
|
7237 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle) |
|
7238 { |
|
7239 jobject javaRect( NULL ); |
|
7240 SWT_TRY |
|
7241 { |
|
7242 SWT_LOG_JNI_CALL(); |
|
7243 SWT_LOG_DATA_2("handle=%x itemhandle=%x", aHandle, aItemHandle); |
|
7244 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7245 HANDLE_TO_QTABLEWIDGETITEM( item, aItemHandle ); |
|
7246 QRect rect = table->visualItemRect( item ); |
|
7247 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
7248 } |
|
7249 SWT_CATCH |
|
7250 return javaRect; |
|
7251 } |
|
7252 |
|
7253 JNIEXPORT void JNICALL OS_NATIVE( QTableWidget_1setCurrentCell ) |
|
7254 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aColumn) |
|
7255 { |
|
7256 SWT_TRY |
|
7257 { |
|
7258 SWT_LOG_JNI_CALL(); |
|
7259 SWT_LOG_DATA_3("handle=%x row=%d column=%d", aHandle, aRow, aColumn); |
|
7260 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7261 table->setCurrentCell( aRow, aColumn ); |
|
7262 } |
|
7263 SWT_CATCH |
|
7264 } |
|
7265 |
|
7266 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidget_1swt_1headerItem ) |
|
7267 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
7268 { |
|
7269 jint itemHandle = 0; |
|
7270 SWT_TRY |
|
7271 { |
|
7272 SWT_LOG_JNI_CALL(); |
|
7273 SWT_LOG_DATA_2("handle=%x index=%x", aHandle, aIndex); |
|
7274 HANDLE_TO_POINTER( QTableWidget*, table, aHandle ); |
|
7275 QTableWidgetItem* item = table->horizontalHeaderItem(aIndex); |
|
7276 if (item == 0) |
|
7277 { |
|
7278 item = new QTableWidgetItem(); |
|
7279 table->setHorizontalHeaderItem(aIndex, item); |
|
7280 } |
|
7281 itemHandle = QTABLEWIDGETITEM_TO_HANDLE(item); |
|
7282 } |
|
7283 SWT_CATCH |
|
7284 return itemHandle; |
|
7285 } |
|
7286 |
|
7287 |
|
7288 // |
|
7289 // QTableView |
|
7290 // |
|
7291 |
|
7292 JNIEXPORT jint JNICALL OS_NATIVE( QTableView_1columnWidth ) |
|
7293 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn) |
|
7294 { |
|
7295 jint width = 0; |
|
7296 SWT_TRY |
|
7297 { |
|
7298 SWT_LOG_JNI_CALL(); |
|
7299 SWT_LOG_DATA_2("handle=%x column=%d", aHandle, aColumn); |
|
7300 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7301 width = table->columnWidth(aColumn); |
|
7302 } |
|
7303 SWT_CATCH |
|
7304 return width; |
|
7305 } |
|
7306 |
|
7307 JNIEXPORT jint JNICALL OS_NATIVE( QTableView_1rowHeight ) |
|
7308 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow) |
|
7309 { |
|
7310 jint height = 0; |
|
7311 SWT_TRY |
|
7312 { |
|
7313 SWT_LOG_JNI_CALL(); |
|
7314 SWT_LOG_DATA_2("handle=%x row=%d", aHandle, aRow); |
|
7315 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7316 height = table->rowHeight(aRow); |
|
7317 } |
|
7318 SWT_CATCH |
|
7319 return height; |
|
7320 } |
|
7321 |
|
7322 |
|
7323 JNIEXPORT jboolean JNICALL OS_NATIVE( QTableView_1showGrid ) |
|
7324 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7325 { |
|
7326 jboolean show = false; |
|
7327 SWT_TRY |
|
7328 { |
|
7329 SWT_LOG_JNI_CALL(); |
|
7330 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7331 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7332 show = table->showGrid(); |
|
7333 } |
|
7334 SWT_CATCH |
|
7335 return show; |
|
7336 } |
|
7337 |
|
7338 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1setShowGrid ) |
|
7339 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aShow) |
|
7340 { |
|
7341 SWT_TRY |
|
7342 { |
|
7343 SWT_LOG_JNI_CALL(); |
|
7344 SWT_LOG_DATA_2("handle=%x show=%d", aHandle, aShow); |
|
7345 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7346 table->setShowGrid(aShow); |
|
7347 } |
|
7348 SWT_CATCH |
|
7349 } |
|
7350 |
|
7351 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1setWordWrap ) |
|
7352 (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aOn) |
|
7353 { |
|
7354 SWT_TRY |
|
7355 { |
|
7356 SWT_LOG_JNI_CALL(); |
|
7357 SWT_LOG_DATA_2("handle=%x on=%d", aHandle, aOn); |
|
7358 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7359 table->setWordWrap(aOn); |
|
7360 } |
|
7361 SWT_CATCH |
|
7362 } |
|
7363 |
|
7364 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1setColumnWidth ) |
|
7365 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn, jint aWidth) |
|
7366 { |
|
7367 SWT_TRY |
|
7368 { |
|
7369 SWT_LOG_JNI_CALL(); |
|
7370 SWT_LOG_DATA_2("handle=%x width=%d", aHandle, aWidth); |
|
7371 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7372 table->setColumnWidth(aColumn, aWidth); |
|
7373 } |
|
7374 SWT_CATCH |
|
7375 } |
|
7376 |
|
7377 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1showRow ) |
|
7378 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow) |
|
7379 { |
|
7380 SWT_TRY |
|
7381 { |
|
7382 SWT_LOG_JNI_CALL(); |
|
7383 SWT_LOG_DATA_2("handle=%x row=%d", aHandle, aRow); |
|
7384 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7385 table->showRow( aRow ); |
|
7386 } |
|
7387 SWT_CATCH |
|
7388 } |
|
7389 |
|
7390 |
|
7391 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1showColumn ) |
|
7392 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn) |
|
7393 { |
|
7394 SWT_TRY |
|
7395 { |
|
7396 SWT_LOG_JNI_CALL(); |
|
7397 SWT_LOG_DATA_2("handle=%x column=%d", aHandle, aColumn); |
|
7398 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7399 table->showColumn( aColumn ); |
|
7400 } |
|
7401 SWT_CATCH |
|
7402 } |
|
7403 |
|
7404 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1setRowHeight ) |
|
7405 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRow, jint aHeight) |
|
7406 { |
|
7407 SWT_TRY |
|
7408 { |
|
7409 SWT_LOG_JNI_CALL(); |
|
7410 SWT_LOG_DATA_3("handle=%x row=%d height=%d", aHandle, aRow, aHeight ); |
|
7411 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7412 table->setRowHeight( aRow, aHeight ); |
|
7413 } |
|
7414 SWT_CATCH |
|
7415 } |
|
7416 |
|
7417 JNIEXPORT void JNICALL OS_NATIVE( QTableView_1setColumnHidden ) |
|
7418 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn, jboolean aHide) |
|
7419 { |
|
7420 SWT_TRY |
|
7421 { |
|
7422 SWT_LOG_JNI_CALL(); |
|
7423 SWT_LOG_DATA_3("handle=%x column=%d hide=%d", aHandle, aColumn, aHide ); |
|
7424 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7425 table->setColumnHidden( aColumn, aHide ); |
|
7426 } |
|
7427 SWT_CATCH |
|
7428 } |
|
7429 |
|
7430 JNIEXPORT jint JNICALL OS_NATIVE( QTableView_1rowAt ) |
|
7431 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aY) |
|
7432 { |
|
7433 jint row = -1; |
|
7434 SWT_TRY |
|
7435 { |
|
7436 SWT_LOG_JNI_CALL(); |
|
7437 SWT_LOG_DATA_2("handle=%x y=%d", aHandle, aY); |
|
7438 HANDLE_TO_POINTER( QTableView*, table, aHandle ); |
|
7439 row = table->rowAt( aY ); |
|
7440 } |
|
7441 SWT_CATCH |
|
7442 return row; |
|
7443 } |
|
7444 // |
|
7445 // QTableWidgetItem |
|
7446 // |
|
7447 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidgetItem_1new ) |
|
7448 (JNIEnv* aJniEnv , jclass) |
|
7449 { |
|
7450 QTableWidgetItem* item = NULL; |
|
7451 SWT_TRY |
|
7452 { |
|
7453 SWT_LOG_JNI_CALL(); |
|
7454 item = new QTableWidgetItem(); |
|
7455 } |
|
7456 SWT_CATCH |
|
7457 return QTABLEWIDGETITEM_TO_HANDLE( item ); |
|
7458 } |
|
7459 |
|
7460 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidgetItem_1flags ) |
|
7461 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7462 { |
|
7463 jint flags = 0; |
|
7464 SWT_TRY |
|
7465 { |
|
7466 SWT_LOG_JNI_CALL(); |
|
7467 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
7468 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7469 flags = item->flags(); |
|
7470 } |
|
7471 SWT_CATCH |
|
7472 return flags; |
|
7473 } |
|
7474 |
|
7475 JNIEXPORT jint JNICALL OS_NATIVE( QTableWidgetItem_1data ) |
|
7476 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRole) |
|
7477 { |
|
7478 jint data = 0; |
|
7479 SWT_TRY |
|
7480 { |
|
7481 SWT_LOG_JNI_CALL(); |
|
7482 SWT_LOG_DATA_2("handle=%x role=%d", aHandle, aRole ); |
|
7483 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7484 data = item->data( aRole ).toInt(); |
|
7485 } |
|
7486 SWT_CATCH |
|
7487 return data; |
|
7488 } |
|
7489 |
|
7490 JNIEXPORT jboolean JNICALL OS_NATIVE( QTableWidgetItem_1grayed ) |
|
7491 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7492 { |
|
7493 jboolean grayed = false; |
|
7494 SWT_TRY |
|
7495 { |
|
7496 SWT_LOG_JNI_CALL(); |
|
7497 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
7498 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7499 grayed = !(item->flags() & Qt::ItemIsEnabled); |
|
7500 } |
|
7501 SWT_CATCH |
|
7502 return grayed; |
|
7503 } |
|
7504 |
|
7505 JNIEXPORT jboolean JNICALL OS_NATIVE( QTableWidgetItem_1isSelected ) |
|
7506 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7507 { |
|
7508 jboolean selected = false; |
|
7509 SWT_TRY |
|
7510 { |
|
7511 SWT_LOG_JNI_CALL(); |
|
7512 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
7513 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7514 selected = item->isSelected(); |
|
7515 } |
|
7516 SWT_CATCH |
|
7517 return selected; |
|
7518 } |
|
7519 |
|
7520 |
|
7521 |
|
7522 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1delete ) |
|
7523 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7524 { |
|
7525 SWT_TRY |
|
7526 { |
|
7527 SWT_LOG_JNI_CALL(); |
|
7528 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
7529 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7530 delete item; |
|
7531 item = NULL; |
|
7532 } |
|
7533 SWT_CATCH |
|
7534 } |
|
7535 |
|
7536 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1setFlags ) |
|
7537 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFlags) |
|
7538 { |
|
7539 SWT_TRY |
|
7540 { |
|
7541 SWT_LOG_JNI_CALL(); |
|
7542 SWT_LOG_DATA_2("handle=%x flags=%d", aHandle, aFlags); |
|
7543 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7544 item->setFlags(static_cast<Qt::ItemFlags>( aFlags )); |
|
7545 } |
|
7546 SWT_CATCH |
|
7547 } |
|
7548 |
|
7549 |
|
7550 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1setData ) |
|
7551 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRole, jint aData) |
|
7552 { |
|
7553 SWT_TRY |
|
7554 { |
|
7555 SWT_LOG_JNI_CALL(); |
|
7556 SWT_LOG_DATA_3("handle=%x role=%d data=%d", aHandle, aRole, aData); |
|
7557 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7558 item->setData(aRole, QVariant(static_cast<int>(aData))); |
|
7559 } |
|
7560 SWT_CATCH |
|
7561 } |
|
7562 |
|
7563 |
|
7564 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1setText ) |
|
7565 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
7566 { |
|
7567 SWT_TRY |
|
7568 { |
|
7569 SWT_LOG_JNI_CALL(); |
|
7570 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7571 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7572 item->setText(swtApp->jniUtils().JavaStringToQString( aJniEnv, aText )); |
|
7573 } |
|
7574 SWT_CATCH |
|
7575 } |
|
7576 |
|
7577 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1swt_1setGrayed ) |
|
7578 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aGrayed) |
|
7579 { |
|
7580 SWT_TRY |
|
7581 { |
|
7582 SWT_LOG_JNI_CALL(); |
|
7583 SWT_LOG_DATA_2("handle=%x grayed=%d", aHandle, aGrayed); |
|
7584 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7585 if (aGrayed) |
|
7586 { |
|
7587 item->setFlags(item->flags() &~ Qt::ItemIsEnabled); |
|
7588 } |
|
7589 else |
|
7590 { |
|
7591 item->setFlags(item->flags() | Qt::ItemIsEnabled); |
|
7592 } |
|
7593 } |
|
7594 SWT_CATCH |
|
7595 } |
|
7596 |
|
7597 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1setSelected ) |
|
7598 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aSelected) |
|
7599 { |
|
7600 SWT_TRY |
|
7601 { |
|
7602 SWT_LOG_JNI_CALL(); |
|
7603 SWT_LOG_DATA_2("handle=%x selected=%d", aHandle, aSelected); |
|
7604 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7605 item->setSelected(aSelected); |
|
7606 } |
|
7607 SWT_CATCH |
|
7608 } |
|
7609 |
|
7610 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1setIcon ) |
|
7611 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIconHandle) |
|
7612 { |
|
7613 SWT_TRY |
|
7614 { |
|
7615 SWT_LOG_JNI_CALL(); |
|
7616 SWT_LOG_DATA_2("handle=%x iconHandle=%d", aHandle, aIconHandle); |
|
7617 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7618 QIcon* icon = reinterpret_cast<QIcon*>(aIconHandle); |
|
7619 item->setIcon(*icon); |
|
7620 } |
|
7621 SWT_CATCH |
|
7622 } |
|
7623 |
|
7624 |
|
7625 JNIEXPORT jstring JNICALL OS_NATIVE( QTableWidgetItem_1text ) |
|
7626 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7627 { |
|
7628 jstring javaString = NULL; |
|
7629 SWT_TRY |
|
7630 { |
|
7631 SWT_LOG_JNI_CALL(); |
|
7632 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7633 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7634 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, item->text()); |
|
7635 } |
|
7636 SWT_CATCH |
|
7637 return javaString; |
|
7638 } |
|
7639 |
|
7640 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1swt_1setBackground ) |
|
7641 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRed, jint aGreen, jint aBlue, jboolean aRestore) |
|
7642 { |
|
7643 SWT_TRY |
|
7644 { |
|
7645 SWT_LOG_JNI_CALL(); |
|
7646 SWT_LOG_DATA_4("handle=%x red=%d green=%d blue=%d", aHandle, aRed, aGreen, aBlue); |
|
7647 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7648 const int& red = static_cast<int>(aRed); |
|
7649 const int& green = static_cast<int>(aGreen); |
|
7650 const int& blue = static_cast<int>(aBlue); |
|
7651 QBrush brush; |
|
7652 if( aRestore == JNI_FALSE ) |
|
7653 { |
|
7654 brush.setColor( QColor(red, green, blue) ); |
|
7655 brush.setStyle( Qt::SolidPattern ); |
|
7656 } |
|
7657 item->setBackground( brush ); |
|
7658 } |
|
7659 SWT_CATCH |
|
7660 } |
|
7661 |
|
7662 |
|
7663 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1swt_1setForeground ) |
|
7664 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRed, jint aGreen, jint aBlue, jboolean aRestore) |
|
7665 { |
|
7666 SWT_TRY |
|
7667 { |
|
7668 SWT_LOG_JNI_CALL(); |
|
7669 SWT_LOG_DATA_4("handle=%x red=%d green=%d blue=%d", aHandle, aRed, aGreen, aBlue); |
|
7670 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7671 const int& red = static_cast<int>(aRed); |
|
7672 const int& green = static_cast<int>(aGreen); |
|
7673 const int& blue = static_cast<int>(aBlue); |
|
7674 QBrush brush; |
|
7675 brush.setStyle( Qt::NoBrush ); |
|
7676 if( aRestore == JNI_FALSE ) |
|
7677 { |
|
7678 brush.setColor( QColor(red, green, blue) ); |
|
7679 brush.setStyle( Qt::SolidPattern ); |
|
7680 } |
|
7681 item->setForeground( brush ); |
|
7682 } |
|
7683 SWT_CATCH |
|
7684 } |
|
7685 |
|
7686 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1swt_1setFont ) |
|
7687 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle) |
|
7688 { |
|
7689 SWT_TRY |
|
7690 { |
|
7691 SWT_LOG_JNI_CALL(); |
|
7692 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7693 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7694 QFont* font = reinterpret_cast<QFont*>( aFontHandle ); |
|
7695 if ( font ) |
|
7696 { |
|
7697 item->setFont( *font ); |
|
7698 } |
|
7699 else |
|
7700 { |
|
7701 item->setFont( QFont() ); |
|
7702 } |
|
7703 } |
|
7704 SWT_CATCH |
|
7705 } |
|
7706 |
|
7707 JNIEXPORT void JNICALL OS_NATIVE( QTableWidgetItem_1setTextAlignment ) |
|
7708 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlignment) |
|
7709 { |
|
7710 SWT_TRY |
|
7711 { |
|
7712 SWT_LOG_JNI_CALL(); |
|
7713 SWT_LOG_DATA_2("handle=%x alignment=%x", aHandle, aAlignment); |
|
7714 HANDLE_TO_QTABLEWIDGETITEM( item, aHandle ); |
|
7715 item->setTextAlignment(aAlignment); |
|
7716 } |
|
7717 SWT_CATCH |
|
7718 } |
|
7719 |
|
7720 // |
|
7721 // QHeaderView |
|
7722 // |
|
7723 JNIEXPORT void JNICALL OS_NATIVE( QHeaderView_1setResizeMode ) |
|
7724 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jint aResizeMode) |
|
7725 { |
|
7726 SWT_TRY |
|
7727 { |
|
7728 SWT_LOG_JNI_CALL(); |
|
7729 SWT_LOG_DATA_3("handle=%x index=%d resizeMode=%d", aHandle, aIndex, aResizeMode); |
|
7730 HANDLE_TO_POINTER( QHeaderView*, header, aHandle ); |
|
7731 header->setResizeMode(aIndex, static_cast<QHeaderView::ResizeMode>( aResizeMode )); |
|
7732 } |
|
7733 SWT_CATCH |
|
7734 } |
|
7735 |
|
7736 JNIEXPORT jint JNICALL OS_NATIVE( QHeaderView_1resizeMode ) |
|
7737 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
7738 { |
|
7739 jint resizeMode = 0; |
|
7740 SWT_TRY |
|
7741 { |
|
7742 SWT_LOG_JNI_CALL(); |
|
7743 SWT_LOG_DATA_2("handle=%x index=%d", aHandle, aIndex); |
|
7744 HANDLE_TO_POINTER( QHeaderView*, header, aHandle ); |
|
7745 resizeMode = static_cast<int>( header->resizeMode(aIndex) ); |
|
7746 } |
|
7747 SWT_CATCH |
|
7748 return resizeMode; |
|
7749 } |
|
7750 |
|
7751 JNIEXPORT jint JNICALL OS_NATIVE( QHeaderView_1sectionSizeHint ) |
|
7752 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
7753 { |
|
7754 jint sizeHint = 0; |
|
7755 SWT_TRY |
|
7756 { |
|
7757 SWT_LOG_JNI_CALL(); |
|
7758 SWT_LOG_DATA_2("handle=%x index=%d", aHandle, aIndex); |
|
7759 HANDLE_TO_POINTER( QHeaderView*, header, aHandle ); |
|
7760 sizeHint = header->sectionSizeHint(aIndex); |
|
7761 } |
|
7762 SWT_CATCH |
|
7763 return sizeHint; |
|
7764 } |
|
7765 |
|
7766 // |
|
7767 // QProgressBar |
|
7768 // |
|
7769 |
|
7770 JNIEXPORT jint JNICALL OS_NATIVE( QProgressBar_1new ) |
|
7771 ( JNIEnv* aJniEnv , jclass) |
|
7772 { |
|
7773 QProgressBar* pb = NULL; |
|
7774 SWT_TRY |
|
7775 { |
|
7776 SWT_LOG_JNI_CALL(); |
|
7777 pb = new QProgressBar(); |
|
7778 } |
|
7779 SWT_CATCH |
|
7780 return POINTER_TO_HANDLE( pb ); |
|
7781 } |
|
7782 |
|
7783 JNIEXPORT void JNICALL OS_NATIVE( QProgressBar_1setOrientation ) |
|
7784 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aOrientation) |
|
7785 { |
|
7786 SWT_TRY |
|
7787 { |
|
7788 SWT_LOG_JNI_CALL(); |
|
7789 SWT_LOG_DATA_2("handle=%x value=%x ", aHandle, aOrientation); |
|
7790 HANDLE_TO_POINTER( QProgressBar*, pb, aHandle ); |
|
7791 pb->setOrientation( static_cast< Qt::Orientation >( aOrientation) ); |
|
7792 } |
|
7793 SWT_CATCH |
|
7794 } |
|
7795 |
|
7796 JNIEXPORT void JNICALL OS_NATIVE( QProgressBar_1setTextInVisible ) |
|
7797 ( JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7798 { |
|
7799 SWT_TRY |
|
7800 { |
|
7801 SWT_LOG_JNI_CALL(); |
|
7802 SWT_LOG_DATA_1("handle=%x ", aHandle ); |
|
7803 HANDLE_TO_POINTER( QProgressBar*, pb, aHandle ); |
|
7804 pb->setTextVisible( false ); |
|
7805 } |
|
7806 SWT_CATCH |
|
7807 } |
|
7808 |
|
7809 JNIEXPORT void JNICALL OS_NATIVE( QProgressBar_1setValue ) |
|
7810 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
7811 { |
|
7812 SWT_TRY |
|
7813 { |
|
7814 SWT_LOG_JNI_CALL(); |
|
7815 SWT_LOG_DATA_2("handle=%x value=%x ", aHandle, aValue); |
|
7816 HANDLE_TO_POINTER( QProgressBar*, pb, aHandle ); |
|
7817 pb->setValue( aValue ); |
|
7818 } |
|
7819 SWT_CATCH |
|
7820 } |
|
7821 |
|
7822 JNIEXPORT void JNICALL OS_NATIVE( QProgressBar_1setMinimum ) |
|
7823 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
7824 { |
|
7825 SWT_TRY |
|
7826 { |
|
7827 SWT_LOG_JNI_CALL(); |
|
7828 SWT_LOG_DATA_2("handle=%x value=%x ", aHandle, aValue); |
|
7829 HANDLE_TO_POINTER( QProgressBar*, pb, aHandle ); |
|
7830 pb->setMinimum( aValue ); |
|
7831 } |
|
7832 SWT_CATCH |
|
7833 } |
|
7834 |
|
7835 JNIEXPORT void JNICALL OS_NATIVE( QProgressBar_1setMaximum ) |
|
7836 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
7837 { |
|
7838 SWT_TRY |
|
7839 { |
|
7840 SWT_LOG_JNI_CALL(); |
|
7841 SWT_LOG_DATA_2("handle=%x value=%x ", aHandle, aValue); |
|
7842 HANDLE_TO_POINTER( QProgressBar*, pb, aHandle ); |
|
7843 pb->setMaximum( aValue ); |
|
7844 } |
|
7845 SWT_CATCH |
|
7846 } |
|
7847 |
|
7848 // |
|
7849 // QComboBox |
|
7850 // |
|
7851 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1new ) |
|
7852 (JNIEnv* aJniEnv , jclass) |
|
7853 { |
|
7854 QComboBox* cb = NULL; |
|
7855 SWT_TRY |
|
7856 { |
|
7857 SWT_LOG_JNI_CALL(); |
|
7858 cb = new QComboBox( ); |
|
7859 } |
|
7860 SWT_CATCH |
|
7861 return POINTER_TO_HANDLE( cb ); |
|
7862 } |
|
7863 |
|
7864 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1clear ) |
|
7865 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7866 { |
|
7867 SWT_TRY |
|
7868 { |
|
7869 SWT_LOG_JNI_CALL(); |
|
7870 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7871 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7872 cb->clear(); |
|
7873 } |
|
7874 SWT_CATCH |
|
7875 } |
|
7876 |
|
7877 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1count ) |
|
7878 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7879 { |
|
7880 jint index=0; |
|
7881 SWT_TRY |
|
7882 { |
|
7883 SWT_LOG_JNI_CALL(); |
|
7884 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7885 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7886 index = cb->count(); |
|
7887 } |
|
7888 SWT_CATCH |
|
7889 return index; |
|
7890 } |
|
7891 |
|
7892 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1currentIndex ) |
|
7893 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
7894 { |
|
7895 jint index=-1; |
|
7896 SWT_TRY |
|
7897 { |
|
7898 SWT_LOG_JNI_CALL(); |
|
7899 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7900 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7901 index = cb->currentIndex(); |
|
7902 } |
|
7903 SWT_CATCH |
|
7904 return index; |
|
7905 } |
|
7906 |
|
7907 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1findText ) |
|
7908 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
7909 { |
|
7910 jint index=-1; |
|
7911 SWT_TRY |
|
7912 { |
|
7913 SWT_LOG_JNI_CALL(); |
|
7914 SWT_LOG_DATA_2("handle=%x text=%x", aHandle, aText); |
|
7915 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7916 index = cb->findText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
7917 } |
|
7918 SWT_CATCH |
|
7919 return index; |
|
7920 } |
|
7921 |
|
7922 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1lineEdit ) |
|
7923 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7924 { |
|
7925 QLineEdit* lineEdit = NULL; |
|
7926 SWT_TRY |
|
7927 { |
|
7928 SWT_LOG_JNI_CALL(); |
|
7929 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7930 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7931 lineEdit = cb->lineEdit(); |
|
7932 } |
|
7933 SWT_CATCH |
|
7934 return POINTER_TO_HANDLE( lineEdit ); |
|
7935 } |
|
7936 |
|
7937 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QComboBox_1view |
|
7938 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7939 { |
|
7940 QAbstractItemView* view = NULL; |
|
7941 SWT_TRY |
|
7942 { |
|
7943 SWT_LOG_JNI_CALL(); |
|
7944 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7945 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7946 view = cb->view(); |
|
7947 } |
|
7948 SWT_CATCH |
|
7949 return POINTER_TO_HANDLE( view ); |
|
7950 } |
|
7951 |
|
7952 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1insertItem ) |
|
7953 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aItem, jint aIndex) |
|
7954 { |
|
7955 SWT_TRY |
|
7956 { |
|
7957 SWT_LOG_JNI_CALL(); |
|
7958 SWT_LOG_DATA_3("handle=%x value=%x index=%x", aHandle, aItem, aIndex); |
|
7959 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7960 int count = cb->count(); |
|
7961 cb->insertItem( aIndex, swtApp->jniUtils().JavaStringToQString( aJniEnv, aItem ) ); |
|
7962 if( count == 0) |
|
7963 { |
|
7964 cb->setCurrentIndex( -1 ); |
|
7965 } |
|
7966 } |
|
7967 SWT_CATCH |
|
7968 } |
|
7969 |
|
7970 JNIEXPORT jstring JNICALL OS_NATIVE( QComboBox_1itemText ) |
|
7971 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
7972 { |
|
7973 jstring itemText=NULL; |
|
7974 SWT_TRY |
|
7975 { |
|
7976 SWT_LOG_JNI_CALL(); |
|
7977 SWT_LOG_DATA_2("handle=%x index=%x", aHandle, aIndex); |
|
7978 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
7979 itemText = swtApp->jniUtils().QStringToJavaString( aJniEnv, cb->itemText( aIndex ) ); |
|
7980 } |
|
7981 SWT_CATCH |
|
7982 return itemText; |
|
7983 } |
|
7984 |
|
7985 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1maxVisibleItems ) |
|
7986 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
7987 { |
|
7988 jint visibleItems = 0; |
|
7989 SWT_TRY |
|
7990 { |
|
7991 SWT_LOG_JNI_CALL(); |
|
7992 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
7993 HANDLE_TO_POINTER(QComboBox*, cb, aHandle); |
|
7994 visibleItems = cb->maxVisibleItems(); |
|
7995 } |
|
7996 SWT_CATCH |
|
7997 return visibleItems; |
|
7998 } |
|
7999 |
|
8000 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1removeItem ) |
|
8001 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
8002 { |
|
8003 SWT_TRY |
|
8004 { |
|
8005 SWT_LOG_JNI_CALL(); |
|
8006 SWT_LOG_DATA_2("handle=%x index=%x", aHandle, aIndex); |
|
8007 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8008 cb->removeItem( aIndex ); |
|
8009 } |
|
8010 SWT_CATCH |
|
8011 } |
|
8012 |
|
8013 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1setCurrentIndex ) |
|
8014 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
8015 { |
|
8016 SWT_TRY |
|
8017 { |
|
8018 SWT_LOG_JNI_CALL(); |
|
8019 SWT_LOG_DATA_2("handle=%x index=%x", aHandle, aIndex); |
|
8020 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8021 cb->setCurrentIndex( aIndex ); |
|
8022 } |
|
8023 SWT_CATCH |
|
8024 } |
|
8025 |
|
8026 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1setEditable ) |
|
8027 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEditable) |
|
8028 { |
|
8029 SWT_TRY |
|
8030 { |
|
8031 SWT_LOG_JNI_CALL(); |
|
8032 SWT_LOG_DATA_2("handle=%x editable=%x", aHandle, aEditable); |
|
8033 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8034 cb->setEditable( aEditable ); |
|
8035 } |
|
8036 SWT_CATCH |
|
8037 } |
|
8038 |
|
8039 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1setInsertPolicy ) |
|
8040 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPolicy) |
|
8041 { |
|
8042 SWT_TRY |
|
8043 { |
|
8044 SWT_LOG_JNI_CALL(); |
|
8045 SWT_LOG_DATA_2("handle=%x policy=%x", aHandle, aPolicy); |
|
8046 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8047 cb->setInsertPolicy( static_cast<QComboBox::InsertPolicy>(aPolicy) ); |
|
8048 } |
|
8049 SWT_CATCH |
|
8050 } |
|
8051 |
|
8052 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1setItemText ) |
|
8053 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText, jint aIndex) |
|
8054 { |
|
8055 SWT_TRY |
|
8056 { |
|
8057 SWT_LOG_JNI_CALL(); |
|
8058 SWT_LOG_DATA_3("handle=%x text=%x index=%x", aHandle, aText, aIndex); |
|
8059 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8060 cb->setItemText( aIndex, swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
8061 } |
|
8062 SWT_CATCH |
|
8063 } |
|
8064 |
|
8065 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1setMaxVisibleItems ) |
|
8066 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aCount) |
|
8067 { |
|
8068 SWT_TRY |
|
8069 { |
|
8070 SWT_LOG_JNI_CALL(); |
|
8071 SWT_LOG_DATA_2("handle=%x count=%x", aHandle, aCount); |
|
8072 HANDLE_TO_POINTER(QComboBox*, cb, aHandle); |
|
8073 cb->setMaxVisibleItems( aCount ); |
|
8074 } |
|
8075 SWT_CATCH |
|
8076 } |
|
8077 |
|
8078 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1setSizeAdjustPolicy ) |
|
8079 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAdjustPolicy) |
|
8080 { |
|
8081 SWT_TRY |
|
8082 { |
|
8083 SWT_LOG_JNI_CALL(); |
|
8084 SWT_LOG_DATA_2("handle=%x policy=%x", aHandle, aAdjustPolicy); |
|
8085 HANDLE_TO_POINTER(QComboBox*, cb, aHandle); |
|
8086 cb->setSizeAdjustPolicy( static_cast<QComboBox::SizeAdjustPolicy> ( aAdjustPolicy ) ); |
|
8087 } |
|
8088 SWT_CATCH |
|
8089 } |
|
8090 |
|
8091 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1swt_1deselect ) |
|
8092 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
8093 { |
|
8094 SWT_TRY |
|
8095 { |
|
8096 SWT_LOG_JNI_CALL(); |
|
8097 SWT_LOG_DATA_1("handle=%x ", aHandle); |
|
8098 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8099 cb->setCurrentIndex( -1 ); |
|
8100 } |
|
8101 SWT_CATCH |
|
8102 } |
|
8103 |
|
8104 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1swt_1getItemHeight ) |
|
8105 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8106 { |
|
8107 jint height = 0; |
|
8108 SWT_TRY |
|
8109 { |
|
8110 SWT_LOG_JNI_CALL(); |
|
8111 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
8112 HANDLE_TO_POINTER(QComboBox*, cb, aHandle); |
|
8113 height = cb->view()->sizeHintForRow(0); |
|
8114 } |
|
8115 SWT_CATCH |
|
8116 return height; |
|
8117 } |
|
8118 |
|
8119 JNIEXPORT jobject JNICALL OS_NATIVE( QComboBox_1swt_1getSelection ) |
|
8120 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8121 { |
|
8122 jobject selection = NULL; |
|
8123 SWT_TRY |
|
8124 { |
|
8125 SWT_LOG_JNI_CALL(); |
|
8126 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
8127 HANDLE_TO_POINTER(QComboBox*, cb, aHandle); |
|
8128 int end = cb->lineEdit()->cursorPosition(); |
|
8129 int start = cb->lineEdit()->selectionStart(); |
|
8130 selection = swtApp->jniUtils().NewJavaPoint( aJniEnv, QPoint((start == -1) ? end : start, end)); |
|
8131 } |
|
8132 SWT_CATCH |
|
8133 return selection; |
|
8134 } |
|
8135 |
|
8136 JNIEXPORT jint JNICALL OS_NATIVE( QComboBox_1swt_1getTextHeight ) |
|
8137 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8138 { |
|
8139 jint height = 0; |
|
8140 SWT_TRY |
|
8141 { |
|
8142 SWT_LOG_JNI_CALL(); |
|
8143 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
8144 HANDLE_TO_POINTER(QComboBox*, cb, aHandle); |
|
8145 height = cb->lineEdit()->sizeHint().height(); |
|
8146 } |
|
8147 SWT_CATCH |
|
8148 return height; |
|
8149 } |
|
8150 |
|
8151 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1swt_1setItems ) |
|
8152 (JNIEnv* aJniEnv , jclass, jint aHandle, jobjectArray aItems) |
|
8153 { |
|
8154 SWT_TRY |
|
8155 { |
|
8156 SWT_LOG_JNI_CALL(); |
|
8157 SWT_LOG_DATA_2("handle=%x items=%x", aHandle, aItems); |
|
8158 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8159 cb->clear(); |
|
8160 cb->addItems( swtApp->jniUtils().JavaStringArrayToQStringList( aJniEnv, aItems ) ); |
|
8161 cb->setCurrentIndex( -1 ); |
|
8162 } |
|
8163 SWT_CATCH |
|
8164 } |
|
8165 |
|
8166 JNIEXPORT void JNICALL OS_NATIVE( QComboBox_1swt_1setText ) |
|
8167 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
8168 { |
|
8169 SWT_TRY |
|
8170 { |
|
8171 SWT_LOG_JNI_CALL(); |
|
8172 SWT_LOG_DATA_2("handle=%x text=%x", aHandle, aText); |
|
8173 HANDLE_TO_POINTER( QComboBox*, cb, aHandle ); |
|
8174 cb->setCurrentIndex( -1 ); |
|
8175 cb->lineEdit()->setText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
8176 } |
|
8177 SWT_CATCH |
|
8178 } |
|
8179 |
|
8180 |
|
8181 // |
|
8182 // QListWidget |
|
8183 // |
|
8184 JNIEXPORT jint JNICALL OS_NATIVE( QListWidget_1new ) |
|
8185 ( JNIEnv* aJniEnv , jclass ) |
|
8186 { |
|
8187 QListWidget* listWidget = NULL; |
|
8188 SWT_TRY |
|
8189 { |
|
8190 SWT_LOG_JNI_CALL(); |
|
8191 listWidget = new QListWidget; |
|
8192 } |
|
8193 SWT_CATCH |
|
8194 return POINTER_TO_HANDLE( listWidget ); |
|
8195 } |
|
8196 |
|
8197 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1addItem ) |
|
8198 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aItem, jint aIconHandle ) |
|
8199 { |
|
8200 SWT_TRY |
|
8201 { |
|
8202 SWT_LOG_JNI_CALL(); |
|
8203 SWT_LOG_DATA_3( "handle=%x text=%x icon=%x", aHandle, aItem, aIconHandle ); |
|
8204 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8205 if ( aIconHandle != 0 ) |
|
8206 { |
|
8207 QListWidgetItem* item = new QListWidgetItem; |
|
8208 item->setText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aItem ) ); |
|
8209 item->setIcon( *( reinterpret_cast<QIcon*>( aIconHandle ) ) ); |
|
8210 listWidget->addItem( item ); |
|
8211 } |
|
8212 else |
|
8213 { |
|
8214 listWidget->addItem( swtApp->jniUtils().JavaStringToQString( aJniEnv, aItem ) ); |
|
8215 } |
|
8216 } |
|
8217 SWT_CATCH_1( ESwtErrorItemNotAdded ); |
|
8218 } |
|
8219 |
|
8220 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1addItems ) |
|
8221 ( JNIEnv* aJniEnv, jclass, jint aHandle, jobjectArray aItems, jintArray aIconHandles ) |
|
8222 { |
|
8223 SWT_TRY |
|
8224 { |
|
8225 SWT_LOG_JNI_CALL(); |
|
8226 SWT_LOG_DATA_3("handle=%x items=%x icons=%x", aHandle, aItems, aIconHandles); |
|
8227 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8228 QStringList items = swtApp->jniUtils().JavaStringArrayToQStringList( aJniEnv, aItems ); |
|
8229 jint* icons = NULL; |
|
8230 if ( aIconHandles != 0 ) |
|
8231 { |
|
8232 jboolean isCopy; |
|
8233 icons = aJniEnv->GetIntArrayElements( aIconHandles, &isCopy ); |
|
8234 } |
|
8235 int count = items.size(); |
|
8236 for (int i = 0; i < count; i++) |
|
8237 { |
|
8238 QListWidgetItem* item = new QListWidgetItem; |
|
8239 item->setText( items.at( i ) ); |
|
8240 if ( icons != NULL ) |
|
8241 { |
|
8242 QIcon* icon = reinterpret_cast<QIcon*>( icons[i] ); |
|
8243 if ( icon ) |
|
8244 { |
|
8245 item->setIcon( *( icon ) ); |
|
8246 } |
|
8247 } |
|
8248 listWidget->addItem( item ); |
|
8249 } |
|
8250 } |
|
8251 SWT_CATCH_1( ESwtErrorItemNotAdded ) |
|
8252 } |
|
8253 |
|
8254 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1clear ) |
|
8255 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
8256 { |
|
8257 SWT_TRY |
|
8258 { |
|
8259 SWT_LOG_JNI_CALL(); |
|
8260 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8261 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8262 listWidget->clear(); |
|
8263 } |
|
8264 SWT_CATCH |
|
8265 } |
|
8266 |
|
8267 JNIEXPORT jint JNICALL OS_NATIVE( QListWidget_1count ) |
|
8268 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
8269 { |
|
8270 jint index=0; |
|
8271 SWT_TRY |
|
8272 { |
|
8273 SWT_LOG_JNI_CALL(); |
|
8274 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
8275 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8276 index = listWidget->count(); |
|
8277 } |
|
8278 SWT_CATCH_1( ESwtErrorCannotGetCount ) |
|
8279 return index; |
|
8280 } |
|
8281 |
|
8282 JNIEXPORT jint JNICALL OS_NATIVE( QListWidget_1currentRow ) |
|
8283 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
8284 { |
|
8285 jint index=-1; |
|
8286 SWT_TRY |
|
8287 { |
|
8288 SWT_LOG_JNI_CALL(); |
|
8289 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
8290 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8291 index = listWidget->currentRow(); |
|
8292 } |
|
8293 SWT_CATCH |
|
8294 return index; |
|
8295 } |
|
8296 |
|
8297 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1insertItem ) |
|
8298 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jstring aItem, jint aIconHandle ) |
|
8299 { |
|
8300 SWT_TRY |
|
8301 { |
|
8302 SWT_LOG_JNI_CALL(); |
|
8303 SWT_LOG_DATA_4("handle=%x text=%x icon=%x index=%x", aHandle, aItem, aIconHandle, aIndex); |
|
8304 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8305 if ( aIconHandle != 0 ) |
|
8306 { |
|
8307 QListWidgetItem* item = new QListWidgetItem; |
|
8308 item->setText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aItem ) ); |
|
8309 item->setIcon( *( reinterpret_cast<QIcon*>( aIconHandle ) ) ); |
|
8310 listWidget->insertItem( aIndex, item ); |
|
8311 } |
|
8312 else |
|
8313 { |
|
8314 listWidget->insertItem( aIndex, swtApp->jniUtils().JavaStringToQString( aJniEnv, aItem ) ); |
|
8315 } |
|
8316 } |
|
8317 SWT_CATCH_1( ESwtErrorItemNotAdded ) |
|
8318 } |
|
8319 |
|
8320 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1scrollToItem ) |
|
8321 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jint aScrollHint) |
|
8322 { |
|
8323 SWT_TRY |
|
8324 { |
|
8325 SWT_LOG_JNI_CALL(); |
|
8326 SWT_LOG_DATA_3( "handle=%x index=%d scroll=%d", aHandle, aIndex, aScrollHint ); |
|
8327 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8328 listWidget->scrollToItem( listWidget->item( aIndex ), static_cast<QAbstractItemView::ScrollHint>(aScrollHint)); |
|
8329 } |
|
8330 SWT_CATCH |
|
8331 } |
|
8332 |
|
8333 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1setSortingEnabled ) |
|
8334 ( JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aStatus ) |
|
8335 { |
|
8336 SWT_TRY |
|
8337 { |
|
8338 SWT_LOG_JNI_CALL(); |
|
8339 SWT_LOG_DATA_2( "handle=%x value=%d", aHandle, aStatus ); |
|
8340 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8341 listWidget->setSortingEnabled( aStatus ); |
|
8342 } |
|
8343 SWT_CATCH |
|
8344 } |
|
8345 |
|
8346 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1sortItems ) |
|
8347 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aOrder ) |
|
8348 { |
|
8349 SWT_TRY |
|
8350 { |
|
8351 SWT_LOG_JNI_CALL(); |
|
8352 SWT_LOG_DATA_2( "handle=%x value=%d", aHandle, aOrder ); |
|
8353 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8354 listWidget->sortItems( static_cast<Qt::SortOrder>( aOrder ) ); |
|
8355 } |
|
8356 SWT_CATCH |
|
8357 } |
|
8358 |
|
8359 JNIEXPORT jint JNICALL OS_NATIVE( QListWidget_1swt_1indexOf ) |
|
8360 ( JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText, jint aStartIndex ) |
|
8361 { |
|
8362 jint index=-1; |
|
8363 SWT_TRY |
|
8364 { |
|
8365 SWT_LOG_JNI_CALL(); |
|
8366 SWT_LOG_DATA_3("handle=%x text=%x index=%x", aHandle, aText, aStartIndex); |
|
8367 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8368 QString text = swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ); |
|
8369 for (int i = aStartIndex; i < listWidget->count(); ++i) |
|
8370 { |
|
8371 if((listWidget->item(i)->text()).compare( text, Qt::CaseSensitive ) == 0 ) |
|
8372 { |
|
8373 index = i; |
|
8374 break; |
|
8375 } |
|
8376 } |
|
8377 } |
|
8378 SWT_CATCH |
|
8379 return index; |
|
8380 } |
|
8381 |
|
8382 JNIEXPORT jboolean JNICALL OS_NATIVE( QListWidget_1swt_1isItemSelected ) |
|
8383 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
8384 { |
|
8385 jboolean res = false; |
|
8386 SWT_TRY |
|
8387 { |
|
8388 SWT_LOG_JNI_CALL(); |
|
8389 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
8390 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8391 QListWidgetItem* item = listWidget->item( aIndex ); |
|
8392 if ( item != NULL ) |
|
8393 { |
|
8394 res = item->isSelected(); |
|
8395 } |
|
8396 } |
|
8397 SWT_CATCH |
|
8398 return res; |
|
8399 } |
|
8400 |
|
8401 JNIEXPORT jboolean JNICALL OS_NATIVE( QListWidget_1swt_1isItemVisible ) |
|
8402 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
8403 { |
|
8404 jboolean res = true; |
|
8405 SWT_TRY |
|
8406 { |
|
8407 SWT_LOG_JNI_CALL(); |
|
8408 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
8409 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8410 QListWidgetItem* item = listWidget->item( aIndex ); |
|
8411 if ( item != NULL ) |
|
8412 { |
|
8413 res = !item->isHidden(); |
|
8414 } |
|
8415 } |
|
8416 SWT_CATCH |
|
8417 return res; |
|
8418 } |
|
8419 |
|
8420 JNIEXPORT jstring JNICALL OS_NATIVE( QListWidget_1swt_1itemText ) |
|
8421 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
8422 { |
|
8423 jstring javaString = NULL; |
|
8424 SWT_TRY |
|
8425 { |
|
8426 SWT_LOG_JNI_CALL(); |
|
8427 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
8428 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8429 javaString = swtApp->jniUtils().QStringToJavaString( aJniEnv, listWidget->item( aIndex )->text() ); |
|
8430 } |
|
8431 SWT_CATCH_1( ESwtErrorCannotGetItem ) |
|
8432 return javaString; |
|
8433 } |
|
8434 |
|
8435 JNIEXPORT jobjectArray JNICALL OS_NATIVE( QListWidget_1swt_1itemTexts ) |
|
8436 ( JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
8437 { |
|
8438 jobjectArray javaStringArray = NULL; |
|
8439 SWT_TRY |
|
8440 { |
|
8441 SWT_LOG_JNI_CALL(); |
|
8442 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8443 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8444 QStringList stringList; |
|
8445 int count = listWidget->count(); |
|
8446 for ( int i = 0; i < count; i++ ) |
|
8447 { |
|
8448 stringList << listWidget->item( i )->text(); |
|
8449 } |
|
8450 javaStringArray = swtApp->jniUtils().NewJavaStringArray( aJniEnv, stringList ); |
|
8451 } |
|
8452 SWT_CATCH |
|
8453 return javaStringArray; |
|
8454 } |
|
8455 |
|
8456 void doQListWidgetSelect( QListWidget* aListWidget, int aStart, int aEnd, QItemSelectionModel::SelectionFlags aCommand ) |
|
8457 { |
|
8458 QModelIndex modelIndexTL = QModelIndex( aListWidget->model()->index( aStart, 0, QModelIndex() ) ); |
|
8459 QModelIndex modelIndexBR = QModelIndex( aListWidget->model()->index( aEnd, 0, QModelIndex() ) ); |
|
8460 QItemSelection itemSelection= QItemSelection( modelIndexTL, modelIndexBR ); |
|
8461 aListWidget->selectionModel()->select( itemSelection, aCommand ); |
|
8462 } |
|
8463 |
|
8464 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1selectIndex ) |
|
8465 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jint aCommand ) |
|
8466 { |
|
8467 SWT_TRY |
|
8468 { |
|
8469 SWT_LOG_JNI_CALL(); |
|
8470 SWT_LOG_DATA_3("handle=%x index=%d command=%x", aHandle, aIndex, aCommand); |
|
8471 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8472 doQListWidgetSelect( listWidget, aIndex, aIndex, static_cast<QItemSelectionModel::SelectionFlags> ( aCommand ) ); |
|
8473 } |
|
8474 SWT_CATCH |
|
8475 } |
|
8476 |
|
8477 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1selectRange ) |
|
8478 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aStart, jint aEnd, jint aCommand ) |
|
8479 { |
|
8480 SWT_TRY |
|
8481 { |
|
8482 SWT_LOG_JNI_CALL(); |
|
8483 SWT_LOG_DATA_4("handle=%x start=%x end=%x command=%x", aHandle, aStart, aEnd, aCommand); |
|
8484 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8485 doQListWidgetSelect( listWidget, aStart, aEnd, static_cast<QItemSelectionModel::SelectionFlags> ( aCommand ) ); |
|
8486 } |
|
8487 SWT_CATCH |
|
8488 } |
|
8489 |
|
8490 void doQListWidgetSetFocusIndex( QListWidget* aListWidget, int aIndex ) |
|
8491 { |
|
8492 QModelIndex modelIndex = QModelIndex( aListWidget->model()->index( aIndex, 0, QModelIndex() ) ); |
|
8493 aListWidget->selectionModel()->setCurrentIndex( modelIndex, QItemSelectionModel::Current ); |
|
8494 } |
|
8495 |
|
8496 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1selectArray ) |
|
8497 ( JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aIndexArr, |
|
8498 jint aIndexArrCount, jint aCommand, jboolean aScrollFocus ) |
|
8499 { |
|
8500 SWT_TRY |
|
8501 { |
|
8502 SWT_LOG_JNI_CALL(); |
|
8503 SWT_LOG_DATA_3("handle=%x indexArrCount=%d focus=%d", |
|
8504 aHandle, aIndexArrCount, aScrollFocus); |
|
8505 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8506 |
|
8507 jboolean isCopy; |
|
8508 jint* indices = aJniEnv->GetIntArrayElements( aIndexArr, &isCopy ); |
|
8509 QItemSelectionModel::SelectionFlags cmd = static_cast<QItemSelectionModel::SelectionFlags> ( aCommand ); |
|
8510 int count = listWidget->count(); |
|
8511 int focusIndex = listWidget->currentRow(); |
|
8512 for ( int i = 0; i < aIndexArrCount; i++ ) |
|
8513 { |
|
8514 if ( indices[i] >= 0 && indices[i] < count) |
|
8515 { |
|
8516 doQListWidgetSelect( listWidget, indices[i], indices[i], cmd ); |
|
8517 focusIndex = indices[i]; |
|
8518 } |
|
8519 } |
|
8520 if( aScrollFocus) |
|
8521 { |
|
8522 listWidget->scrollToItem( listWidget->item( focusIndex ) ); |
|
8523 doQListWidgetSetFocusIndex( listWidget, focusIndex ); |
|
8524 } |
|
8525 } |
|
8526 SWT_CATCH |
|
8527 } |
|
8528 |
|
8529 JNIEXPORT jintArray JNICALL OS_NATIVE( QListWidget_1swt_1selectedRows ) |
|
8530 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn ) |
|
8531 { |
|
8532 jintArray javaArray( NULL ); |
|
8533 SWT_TRY |
|
8534 { |
|
8535 SWT_LOG_JNI_CALL(); |
|
8536 SWT_LOG_DATA_2("handle=%x column=%d ", aHandle, aColumn ); |
|
8537 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8538 QModelIndexList indexList = listWidget->selectionModel()->selectedRows( aColumn ); |
|
8539 const int count = indexList.count(); |
|
8540 if( count > 0 ) |
|
8541 { |
|
8542 QVector<int> indexHandles( count ); |
|
8543 int* indexData = indexHandles.data(); |
|
8544 for ( int i = 0; i < count; ++i ) |
|
8545 { |
|
8546 indexData[i] = indexList.value( i ).row(); |
|
8547 } |
|
8548 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, indexData, count ); |
|
8549 } |
|
8550 } |
|
8551 SWT_CATCH_1( ESwtErrorCannotGetSelection ) |
|
8552 return javaArray; |
|
8553 } |
|
8554 |
|
8555 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1removeIndex ) |
|
8556 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
8557 { |
|
8558 SWT_TRY |
|
8559 { |
|
8560 SWT_LOG_JNI_CALL(); |
|
8561 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
8562 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8563 delete listWidget->takeItem( aIndex ); |
|
8564 } |
|
8565 SWT_CATCH_1( ESwtErrorItemNotRemoved ) |
|
8566 } |
|
8567 |
|
8568 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1removeRange ) |
|
8569 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aStart, jint aEnd ) |
|
8570 { |
|
8571 SWT_TRY |
|
8572 { |
|
8573 SWT_LOG_JNI_CALL(); |
|
8574 SWT_LOG_DATA_3( "handle=%x start=%d end=%d", aHandle, aStart, aEnd ); |
|
8575 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8576 for ( int i = aEnd; i >= aStart; --i ) |
|
8577 { |
|
8578 delete listWidget->takeItem( i ); |
|
8579 } |
|
8580 } |
|
8581 SWT_CATCH_1( ESwtErrorItemNotRemoved ) |
|
8582 } |
|
8583 |
|
8584 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1removeArray ) |
|
8585 ( JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aIndexArr, jint aIndexArrCount ) |
|
8586 { |
|
8587 SWT_TRY |
|
8588 { |
|
8589 SWT_LOG_JNI_CALL(); |
|
8590 SWT_LOG_DATA_2( "handle=%x indexArrCount=%d", aHandle, aIndexArrCount ); |
|
8591 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8592 jboolean isCopy; |
|
8593 jint* indices = aJniEnv->GetIntArrayElements( aIndexArr, &isCopy ); |
|
8594 if( indices != NULL ) |
|
8595 { |
|
8596 for ( int i = aIndexArrCount - 1; i >= 0; i-- ) |
|
8597 { |
|
8598 delete listWidget->takeItem( indices[i] ); |
|
8599 } |
|
8600 } |
|
8601 } |
|
8602 SWT_CATCH_1( ESwtErrorItemNotRemoved ) |
|
8603 } |
|
8604 |
|
8605 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1setFocusIndex ) |
|
8606 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex ) |
|
8607 { |
|
8608 SWT_TRY |
|
8609 { |
|
8610 SWT_LOG_JNI_CALL(); |
|
8611 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
8612 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8613 doQListWidgetSetFocusIndex( listWidget, aIndex ); |
|
8614 } |
|
8615 SWT_CATCH |
|
8616 } |
|
8617 |
|
8618 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1setItemVisible ) |
|
8619 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint index, jboolean aStatus ) |
|
8620 { |
|
8621 SWT_TRY |
|
8622 { |
|
8623 SWT_LOG_JNI_CALL(); |
|
8624 SWT_LOG_DATA_3( "handle=%x index=%d status=%d", aHandle, index, aStatus ); |
|
8625 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8626 QListWidgetItem* item = listWidget->item( index ); |
|
8627 if ( item != NULL ) |
|
8628 { |
|
8629 item->setHidden( !aStatus ); |
|
8630 } |
|
8631 } |
|
8632 SWT_CATCH |
|
8633 } |
|
8634 |
|
8635 JNIEXPORT void JNICALL OS_NATIVE( QListWidget_1swt_1setText ) |
|
8636 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jstring aText) |
|
8637 { |
|
8638 SWT_TRY |
|
8639 { |
|
8640 SWT_LOG_JNI_CALL(); |
|
8641 SWT_LOG_DATA_3( "handle=%x index=%d text=%d", aHandle, aIndex, aText ); |
|
8642 HANDLE_TO_POINTER( QListWidget*, listWidget, aHandle ); |
|
8643 listWidget->item( aIndex )->setText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
8644 } |
|
8645 SWT_CATCH |
|
8646 } |
|
8647 |
|
8648 // |
|
8649 // QTreeWidget |
|
8650 // |
|
8651 |
|
8652 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1new ) |
|
8653 (JNIEnv* aJniEnv , jclass) |
|
8654 { |
|
8655 QTreeWidget* treeWidget = NULL; |
|
8656 SWT_TRY |
|
8657 { |
|
8658 SWT_LOG_JNI_CALL(); |
|
8659 treeWidget = new QTreeWidget; |
|
8660 } |
|
8661 SWT_CATCH |
|
8662 return POINTER_TO_HANDLE( treeWidget ); |
|
8663 } |
|
8664 |
|
8665 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1addTopLevelItem ) |
|
8666 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle) |
|
8667 { |
|
8668 SWT_TRY |
|
8669 { |
|
8670 SWT_LOG_JNI_CALL(); |
|
8671 SWT_LOG_DATA_2( "handle=%x item=%x", aHandle, aItemHandle ); |
|
8672 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8673 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aItemHandle ); |
|
8674 treeWidget->addTopLevelItem( treeWidgetItem ); |
|
8675 } |
|
8676 SWT_CATCH |
|
8677 } |
|
8678 |
|
8679 JNIEXPORT jintArray JNICALL OS_NATIVE( QTreeWidget_1addTopLevelItems ) |
|
8680 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aCount) |
|
8681 { |
|
8682 jintArray javaArray = NULL; |
|
8683 SWT_TRY |
|
8684 { |
|
8685 SWT_LOG_JNI_CALL(); |
|
8686 SWT_LOG_DATA_2( "handle=%x count=%x", aHandle, aCount ); |
|
8687 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8688 QList<QTreeWidgetItem *> items; |
|
8689 QVector<int> handles( aCount ); |
|
8690 int* handleData = handles.data(); |
|
8691 for (int i = 0; i < aCount; ++i) |
|
8692 { |
|
8693 QTreeWidgetItem* item = new QTreeWidgetItem(); |
|
8694 handleData[i] = QTREEWIDGETITEM_TO_HANDLE( item ); |
|
8695 items.append( item ); |
|
8696 } |
|
8697 treeWidget->addTopLevelItems( items ); |
|
8698 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, handleData, aCount ); |
|
8699 } |
|
8700 SWT_CATCH |
|
8701 return javaArray; |
|
8702 } |
|
8703 |
|
8704 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1clear ) |
|
8705 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8706 { |
|
8707 SWT_TRY |
|
8708 { |
|
8709 SWT_LOG_JNI_CALL(); |
|
8710 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8711 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8712 treeWidget->clear(); |
|
8713 } |
|
8714 SWT_CATCH |
|
8715 } |
|
8716 |
|
8717 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1currentItem ) |
|
8718 (JNIEnv* aJniEnv , jclass, jint aHandle ) |
|
8719 { |
|
8720 QTreeWidgetItem* treeWidgetItem = NULL; |
|
8721 SWT_TRY |
|
8722 { |
|
8723 SWT_LOG_JNI_CALL(); |
|
8724 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8725 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8726 treeWidgetItem = treeWidget->currentItem(); |
|
8727 } |
|
8728 SWT_CATCH |
|
8729 return reinterpret_cast< jint >( treeWidgetItem ); |
|
8730 } |
|
8731 |
|
8732 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1indexOfTopLevelItem ) |
|
8733 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle) |
|
8734 { |
|
8735 jint index = 0; |
|
8736 SWT_TRY |
|
8737 { |
|
8738 SWT_LOG_JNI_CALL(); |
|
8739 SWT_LOG_DATA_2( "handle=%x item=%x", aHandle, aItemHandle ); |
|
8740 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8741 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aItemHandle ); |
|
8742 index = treeWidget->indexOfTopLevelItem(treeWidgetItem ); |
|
8743 } |
|
8744 SWT_CATCH |
|
8745 return index; |
|
8746 } |
|
8747 |
|
8748 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1insertTopLevelItem ) |
|
8749 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle, jint aIndex) |
|
8750 { |
|
8751 SWT_TRY |
|
8752 { |
|
8753 SWT_LOG_JNI_CALL(); |
|
8754 SWT_LOG_DATA_3( "handle=%x item=%x index=%d", aHandle, aItemHandle, aIndex ); |
|
8755 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8756 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aItemHandle ); |
|
8757 treeWidget->insertTopLevelItem( aIndex,treeWidgetItem ); |
|
8758 } |
|
8759 SWT_CATCH |
|
8760 } |
|
8761 |
|
8762 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1itemAt ) |
|
8763 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
8764 { |
|
8765 QTreeWidgetItem* treeWidgetItem = NULL; |
|
8766 SWT_TRY |
|
8767 { |
|
8768 SWT_LOG_JNI_CALL(); |
|
8769 SWT_LOG_DATA_3( "handle=%x x=%x y=%d", aHandle, aX, aY ); |
|
8770 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8771 treeWidgetItem = treeWidget->itemAt( QPoint( aX, aY ) ); |
|
8772 } |
|
8773 SWT_CATCH |
|
8774 return reinterpret_cast< jint >( treeWidgetItem ); |
|
8775 } |
|
8776 |
|
8777 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1scrollToItem ) |
|
8778 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle, jint aScrollHint) |
|
8779 { |
|
8780 SWT_TRY |
|
8781 { |
|
8782 SWT_LOG_JNI_CALL(); |
|
8783 SWT_LOG_DATA_3( "handle=%x item=%x index=%d", aHandle, aItemHandle, aScrollHint ); |
|
8784 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8785 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aItemHandle ); |
|
8786 treeWidget->scrollToItem( treeWidgetItem, static_cast<QAbstractItemView::ScrollHint>( aScrollHint ) ); |
|
8787 } |
|
8788 SWT_CATCH |
|
8789 } |
|
8790 |
|
8791 JNIEXPORT jintArray JNICALL OS_NATIVE( QTreeWidget_1selectedItems ) |
|
8792 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8793 { |
|
8794 jintArray javaArray = NULL; |
|
8795 SWT_TRY |
|
8796 { |
|
8797 SWT_LOG_JNI_CALL(); |
|
8798 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8799 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8800 |
|
8801 QList<QTreeWidgetItem*> selectedItems = treeWidget->selectedItems(); |
|
8802 int selectedItemsCount = selectedItems.size(); |
|
8803 QVector<int> handles(selectedItemsCount); |
|
8804 int* handleData = handles.data(); |
|
8805 |
|
8806 for(int i = 0; i < selectedItemsCount; ++i) |
|
8807 { |
|
8808 handleData[i] = QTREEWIDGETITEM_TO_HANDLE(selectedItems.at(i)); |
|
8809 } |
|
8810 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, handleData, selectedItemsCount ); |
|
8811 } |
|
8812 SWT_CATCH |
|
8813 return javaArray; |
|
8814 } |
|
8815 |
|
8816 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1setColumnCount ) |
|
8817 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aCount) |
|
8818 { |
|
8819 SWT_TRY |
|
8820 { |
|
8821 SWT_LOG_JNI_CALL(); |
|
8822 SWT_LOG_DATA_2( "handle=%x count=%x", aHandle, aCount ); |
|
8823 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8824 treeWidget->setColumnCount( aCount ); |
|
8825 } |
|
8826 SWT_CATCH |
|
8827 } |
|
8828 |
|
8829 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1setCurrentItem ) |
|
8830 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle) |
|
8831 { |
|
8832 SWT_TRY |
|
8833 { |
|
8834 SWT_LOG_JNI_CALL(); |
|
8835 SWT_LOG_DATA_2( "handle=%x count=%x", aHandle, aItemHandle ); |
|
8836 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8837 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aItemHandle ); |
|
8838 treeWidget->setCurrentItem( treeWidgetItem ); |
|
8839 } |
|
8840 SWT_CATCH |
|
8841 } |
|
8842 |
|
8843 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1swt_1rowAt ) |
|
8844 (JNIEnv* aJniEnv , jclass, jint aHandle, jint xPos, jint yPos) |
|
8845 { |
|
8846 jint index = 0; |
|
8847 SWT_TRY |
|
8848 { |
|
8849 SWT_LOG_JNI_CALL(); |
|
8850 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8851 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8852 index = treeWidget->indexOfTopLevelItem( treeWidget->itemAt( xPos, yPos ) ); |
|
8853 } |
|
8854 SWT_CATCH |
|
8855 return index; |
|
8856 } |
|
8857 |
|
8858 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1swt_1selectionCount ) |
|
8859 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8860 { |
|
8861 jint count = 0; |
|
8862 SWT_TRY |
|
8863 { |
|
8864 SWT_LOG_JNI_CALL(); |
|
8865 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8866 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8867 count = treeWidget->selectedItems().size(); |
|
8868 } |
|
8869 SWT_CATCH |
|
8870 return count; |
|
8871 } |
|
8872 |
|
8873 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1swt_1setHeaderStretch ) |
|
8874 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aVisible) |
|
8875 { |
|
8876 SWT_TRY |
|
8877 { |
|
8878 SWT_LOG_JNI_CALL(); |
|
8879 SWT_LOG_DATA_2( "handle=%x visible=%x", aHandle, aVisible ); |
|
8880 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8881 treeWidget->header()->setStretchLastSection( aVisible ); |
|
8882 } |
|
8883 SWT_CATCH |
|
8884 } |
|
8885 |
|
8886 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1swt_1setHeaderVisible ) |
|
8887 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aVisible) |
|
8888 { |
|
8889 SWT_TRY |
|
8890 { |
|
8891 SWT_LOG_JNI_CALL(); |
|
8892 SWT_LOG_DATA_2( "handle=%x visible=%x", aHandle, aVisible ); |
|
8893 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8894 treeWidget->header()->setVisible( aVisible ); |
|
8895 } |
|
8896 SWT_CATCH |
|
8897 } |
|
8898 |
|
8899 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidget_1takeTopLevelItem ) |
|
8900 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
8901 { |
|
8902 SWT_TRY |
|
8903 { |
|
8904 SWT_LOG_JNI_CALL(); |
|
8905 SWT_LOG_DATA_2( "handle=%x index=%d", aHandle, aIndex ); |
|
8906 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8907 QTreeWidgetItem* item = treeWidget->takeTopLevelItem(aIndex); |
|
8908 delete item; |
|
8909 item = NULL; |
|
8910 } |
|
8911 SWT_CATCH |
|
8912 } |
|
8913 |
|
8914 JNIEXPORT jobject JNICALL OS_NATIVE( QTreeWidget_1visualItemRect ) |
|
8915 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aItemHandle) |
|
8916 { |
|
8917 jobject javaRect = NULL; |
|
8918 SWT_TRY |
|
8919 { |
|
8920 SWT_LOG_JNI_CALL(); |
|
8921 SWT_LOG_DATA_2( "handle=%x item=%x", aHandle, aItemHandle ); |
|
8922 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
8923 HANDLE_TO_QTREEWIDGETITEM( item, aItemHandle ); |
|
8924 QRect rect = treeWidget->visualItemRect( item ); |
|
8925 javaRect = swtApp->jniUtils().NewJavaRectangle( aJniEnv, rect ); |
|
8926 } |
|
8927 SWT_CATCH |
|
8928 return javaRect; |
|
8929 } |
|
8930 |
|
8931 // |
|
8932 // QTreeWidgetItem |
|
8933 // |
|
8934 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidgetItem_1new ) |
|
8935 (JNIEnv* aJniEnv , jclass) |
|
8936 { |
|
8937 QTreeWidgetItem* treeWidgetItem = NULL; |
|
8938 SWT_TRY |
|
8939 { |
|
8940 SWT_LOG_JNI_CALL(); |
|
8941 treeWidgetItem = new QTreeWidgetItem(); |
|
8942 } |
|
8943 SWT_CATCH |
|
8944 return reinterpret_cast< jint >( treeWidgetItem ); |
|
8945 } |
|
8946 |
|
8947 JNIEXPORT jintArray JNICALL OS_NATIVE( QTreeWidgetItem_1addChildren ) |
|
8948 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aCount) |
|
8949 { |
|
8950 jintArray javaArray = NULL; |
|
8951 SWT_TRY |
|
8952 { |
|
8953 SWT_LOG_JNI_CALL(); |
|
8954 SWT_LOG_DATA_2( "handle=%x count=%x", aHandle, aCount ); |
|
8955 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
8956 QList<QTreeWidgetItem *> items; |
|
8957 QVector<int> handles( aCount ); |
|
8958 int* handleData = handles.data(); |
|
8959 for (int i = 0; i < aCount; ++i) |
|
8960 { |
|
8961 QTreeWidgetItem* item = new QTreeWidgetItem(); |
|
8962 handleData[i] = QTREEWIDGETITEM_TO_HANDLE( item ); |
|
8963 items.append( item ); |
|
8964 } |
|
8965 treeWidgetItem->addChildren( items ); |
|
8966 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, handleData, aCount ); |
|
8967 } |
|
8968 SWT_CATCH |
|
8969 return javaArray; |
|
8970 } |
|
8971 |
|
8972 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidgetItem_1checkState ) |
|
8973 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
8974 { |
|
8975 jint checkState = 0; |
|
8976 SWT_TRY |
|
8977 { |
|
8978 SWT_LOG_JNI_CALL(); |
|
8979 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
8980 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
8981 checkState = treeWidgetItem->checkState( 0 ); |
|
8982 } |
|
8983 SWT_CATCH |
|
8984 return checkState; |
|
8985 } |
|
8986 |
|
8987 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidgetItem_1indexOfChild ) |
|
8988 (JNIEnv* aJniEnv , jclass, jint aParentHandle, jint aChildHandle) |
|
8989 { |
|
8990 int index = -1; |
|
8991 SWT_TRY |
|
8992 { |
|
8993 SWT_LOG_JNI_CALL(); |
|
8994 SWT_LOG_DATA_2( "parentHandle=%x childHandle=%x", aParentHandle, aChildHandle ); |
|
8995 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aParentHandle ); |
|
8996 HANDLE_TO_QTREEWIDGETITEM( childItem, aChildHandle ); |
|
8997 index = treeWidgetItem->indexOfChild( childItem ); |
|
8998 } |
|
8999 SWT_CATCH |
|
9000 return index; |
|
9001 } |
|
9002 |
|
9003 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1insertChild ) |
|
9004 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aChildHandle, jint aIndex) |
|
9005 { |
|
9006 SWT_TRY |
|
9007 { |
|
9008 SWT_LOG_JNI_CALL(); |
|
9009 SWT_LOG_DATA_3( "handle=%x child=%x index=%d", aHandle, aChildHandle, aIndex ); |
|
9010 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9011 HANDLE_TO_QTREEWIDGETITEM( childItem, aChildHandle ); |
|
9012 treeWidgetItem->insertChild( aIndex, childItem ); |
|
9013 } |
|
9014 SWT_CATCH |
|
9015 } |
|
9016 |
|
9017 JNIEXPORT jboolean JNICALL OS_NATIVE( QTreeWidgetItem_1isExpanded ) |
|
9018 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9019 { |
|
9020 jboolean expanded = false; |
|
9021 SWT_TRY |
|
9022 { |
|
9023 SWT_LOG_JNI_CALL(); |
|
9024 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
9025 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9026 expanded = treeWidgetItem->isExpanded(); |
|
9027 } |
|
9028 SWT_CATCH |
|
9029 return expanded; |
|
9030 } |
|
9031 |
|
9032 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1removeChild ) |
|
9033 (JNIEnv* aJniEnv , jclass, jint aParentHandle, jint aChildHandle) |
|
9034 { |
|
9035 SWT_TRY |
|
9036 { |
|
9037 SWT_LOG_JNI_CALL(); |
|
9038 SWT_LOG_DATA_2( "handle=%x child=%x ", aParentHandle, aChildHandle ); |
|
9039 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aParentHandle ); |
|
9040 HANDLE_TO_QTREEWIDGETITEM( childItem, aChildHandle ); |
|
9041 treeWidgetItem->removeChild( childItem ); |
|
9042 } |
|
9043 SWT_CATCH |
|
9044 } |
|
9045 |
|
9046 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1setCheckState ) |
|
9047 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFlags) |
|
9048 { |
|
9049 SWT_TRY |
|
9050 { |
|
9051 SWT_LOG_JNI_CALL(); |
|
9052 SWT_LOG_DATA_2( "handle=%x flags=%x", aHandle, aFlags ); |
|
9053 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9054 treeWidgetItem->setCheckState(0, static_cast<Qt::CheckState>( aFlags ) ); |
|
9055 } |
|
9056 SWT_CATCH |
|
9057 } |
|
9058 |
|
9059 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1setExpanded ) |
|
9060 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aExpanded) |
|
9061 { |
|
9062 SWT_TRY |
|
9063 { |
|
9064 SWT_LOG_JNI_CALL(); |
|
9065 SWT_LOG_DATA_2( "handle=%x expanded=%x", aHandle, aExpanded ); |
|
9066 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9067 treeWidgetItem->setExpanded( aExpanded ); |
|
9068 } |
|
9069 SWT_CATCH |
|
9070 } |
|
9071 |
|
9072 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1setFlags ) |
|
9073 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFlags) |
|
9074 { |
|
9075 SWT_TRY |
|
9076 { |
|
9077 SWT_LOG_JNI_CALL(); |
|
9078 SWT_LOG_DATA_2( "handle=%x flags=%x", aHandle, aFlags ); |
|
9079 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9080 treeWidgetItem->setFlags( static_cast<Qt::ItemFlags>( aFlags ) ); |
|
9081 } |
|
9082 SWT_CATCH |
|
9083 } |
|
9084 |
|
9085 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1setIcon ) |
|
9086 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle) |
|
9087 { |
|
9088 SWT_TRY |
|
9089 { |
|
9090 SWT_LOG_JNI_CALL(); |
|
9091 SWT_LOG_DATA_2( "handle=%x iconHandle=%x", aHandle, aImageHandle ); |
|
9092 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9093 QIcon* icon = reinterpret_cast<QIcon*>( aImageHandle ); |
|
9094 treeWidgetItem->setIcon( 0, *icon ); |
|
9095 } |
|
9096 SWT_CATCH |
|
9097 } |
|
9098 |
|
9099 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1setSelected ) |
|
9100 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aSelected) |
|
9101 { |
|
9102 SWT_TRY |
|
9103 { |
|
9104 SWT_LOG_JNI_CALL(); |
|
9105 SWT_LOG_DATA_2( "handle=%x text=%x", aHandle, aSelected ); |
|
9106 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9107 treeWidgetItem->setSelected( aSelected ); |
|
9108 } |
|
9109 SWT_CATCH |
|
9110 } |
|
9111 |
|
9112 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1setText ) |
|
9113 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
9114 { |
|
9115 SWT_TRY |
|
9116 { |
|
9117 SWT_LOG_JNI_CALL(); |
|
9118 SWT_LOG_DATA_2( "handle=%x text=%x", aHandle, aText ); |
|
9119 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9120 treeWidgetItem->setText( 0, swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
9121 } |
|
9122 SWT_CATCH |
|
9123 } |
|
9124 |
|
9125 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidgetItem_1swt_1isSameParent ) |
|
9126 (JNIEnv* aJniEnv , jclass, jint aFirstHandle, jint aLastHandle) |
|
9127 { |
|
9128 jint handle = -1; |
|
9129 SWT_TRY |
|
9130 { |
|
9131 SWT_LOG_JNI_CALL(); |
|
9132 SWT_LOG_DATA_2( "handle=%x handle=%x ", aFirstHandle, aLastHandle ); |
|
9133 HANDLE_TO_QTREEWIDGETITEM( firstTreeWidgetItem, aFirstHandle ); |
|
9134 HANDLE_TO_QTREEWIDGETITEM( lastTreeWidgetItem, aLastHandle ); |
|
9135 |
|
9136 if(firstTreeWidgetItem->parent()==lastTreeWidgetItem->parent()) |
|
9137 { |
|
9138 handle = QTREEWIDGETITEM_TO_HANDLE( firstTreeWidgetItem->parent() ); |
|
9139 } |
|
9140 } |
|
9141 SWT_CATCH |
|
9142 return handle; |
|
9143 } |
|
9144 |
|
9145 JNIEXPORT jint JNICALL OS_NATIVE( QTreeWidget_1swt_1parentChildCount ) |
|
9146 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9147 { |
|
9148 jint count = 0; |
|
9149 SWT_TRY |
|
9150 { |
|
9151 SWT_LOG_JNI_CALL(); |
|
9152 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
9153 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9154 count = treeWidgetItem->parent()->childCount(); |
|
9155 } |
|
9156 SWT_CATCH |
|
9157 return count; |
|
9158 } |
|
9159 |
|
9160 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1swt_1setBackground ) |
|
9161 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRed, jint aGreen, jint aBlue, jboolean aRestore) |
|
9162 { |
|
9163 SWT_TRY |
|
9164 { |
|
9165 SWT_LOG_JNI_CALL(); |
|
9166 SWT_LOG_DATA_4( "handle=%x red=%d green=%d blue=%d", aHandle, aRed, aGreen, aBlue ); |
|
9167 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9168 const int& red = static_cast<int>(aRed); |
|
9169 const int& green = static_cast<int>(aGreen); |
|
9170 const int& blue = static_cast<int>(aBlue); |
|
9171 QBrush brush; |
|
9172 if( aRestore == JNI_FALSE ) |
|
9173 { |
|
9174 brush.setColor( QColor(red, green, blue) ); |
|
9175 brush.setStyle( Qt::SolidPattern ); |
|
9176 } |
|
9177 treeWidgetItem->setBackground( 0, brush ); |
|
9178 } |
|
9179 SWT_CATCH |
|
9180 } |
|
9181 |
|
9182 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1swt_1setFont ) |
|
9183 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle) |
|
9184 { |
|
9185 SWT_TRY |
|
9186 { |
|
9187 SWT_LOG_JNI_CALL(); |
|
9188 SWT_LOG_DATA_2( "handle=%x fontHandle=%x", aHandle, aFontHandle ); |
|
9189 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9190 QFont* font = reinterpret_cast<QFont*>( aFontHandle ); |
|
9191 if ( font ) |
|
9192 { |
|
9193 treeWidgetItem->setFont( 0, *font ); |
|
9194 } |
|
9195 else |
|
9196 { |
|
9197 treeWidgetItem->setFont( 0, QFont() ); |
|
9198 } |
|
9199 } |
|
9200 SWT_CATCH |
|
9201 } |
|
9202 |
|
9203 JNIEXPORT void JNICALL OS_NATIVE( QTreeWidgetItem_1swt_1setForeground ) |
|
9204 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aRed, jint aGreen, jint aBlue, jboolean aRestore) |
|
9205 { |
|
9206 SWT_TRY |
|
9207 { |
|
9208 SWT_LOG_JNI_CALL(); |
|
9209 SWT_LOG_DATA_4( "handle=%x red=%d green=%d blue=%d", aHandle, aRed, aGreen, aBlue ); |
|
9210 HANDLE_TO_QTREEWIDGETITEM( treeWidgetItem, aHandle ); |
|
9211 const int& red = static_cast<int>(aRed); |
|
9212 const int& green = static_cast<int>(aGreen); |
|
9213 const int& blue = static_cast<int>(aBlue); |
|
9214 QBrush brush; |
|
9215 if ( aRestore == JNI_FALSE ) |
|
9216 { |
|
9217 brush.setColor( QColor(red, green, blue) ); |
|
9218 brush.setStyle( Qt::SolidPattern ); |
|
9219 } |
|
9220 treeWidgetItem->setForeground( 0, brush ); |
|
9221 } |
|
9222 SWT_CATCH |
|
9223 } |
|
9224 |
|
9225 // |
|
9226 // QTreeView |
|
9227 // |
|
9228 JNIEXPORT jint JNICALL OS_NATIVE( QTreeView_1columnWidth ) |
|
9229 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn) |
|
9230 { |
|
9231 jint columnWidth = 0; |
|
9232 SWT_TRY |
|
9233 { |
|
9234 SWT_LOG_JNI_CALL(); |
|
9235 SWT_LOG_DATA_2( "handle=%x column=%x", aHandle, aColumn ); |
|
9236 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
9237 columnWidth = treeWidget->columnWidth( aColumn ); |
|
9238 } |
|
9239 SWT_CATCH |
|
9240 return columnWidth; |
|
9241 } |
|
9242 |
|
9243 JNIEXPORT void JNICALL OS_NATIVE( QTreeView_1resizeColumnToContents ) |
|
9244 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aColumn) |
|
9245 { |
|
9246 SWT_TRY |
|
9247 { |
|
9248 SWT_LOG_JNI_CALL(); |
|
9249 SWT_LOG_DATA_2( "handle=%x column=%x", aHandle, aColumn ); |
|
9250 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
9251 treeWidget->resizeColumnToContents( aColumn ); |
|
9252 } |
|
9253 SWT_CATCH |
|
9254 } |
|
9255 |
|
9256 JNIEXPORT void JNICALL OS_NATIVE( QTreeView_1selectAll ) |
|
9257 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9258 { |
|
9259 SWT_TRY |
|
9260 { |
|
9261 SWT_LOG_JNI_CALL(); |
|
9262 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
9263 HANDLE_TO_POINTER( QTreeWidget*, treeWidget, aHandle ); |
|
9264 treeWidget->selectAll(); |
|
9265 } |
|
9266 SWT_CATCH |
|
9267 } |
|
9268 |
|
9269 // |
|
9270 // QDateTimeEdit |
|
9271 // |
|
9272 JNIEXPORT jint JNICALL OS_NATIVE( QDateTimeEdit_1new ) |
|
9273 (JNIEnv* aJniEnv , jclass) |
|
9274 { |
|
9275 QDateTimeEdit* editor = NULL; |
|
9276 SWT_TRY |
|
9277 { |
|
9278 SWT_LOG_JNI_CALL(); |
|
9279 editor = new QDateTimeEdit(); |
|
9280 editor->setTimeSpec( Qt::UTC ); |
|
9281 } |
|
9282 SWT_CATCH |
|
9283 return POINTER_TO_HANDLE( editor ); |
|
9284 } |
|
9285 |
|
9286 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QDateTimeEdit_1calendarWidget |
|
9287 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9288 { |
|
9289 QCalendarWidget* calendar = NULL; |
|
9290 SWT_TRY |
|
9291 { |
|
9292 SWT_LOG_JNI_CALL(); |
|
9293 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9294 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9295 calendar = editor->calendarWidget(); |
|
9296 } |
|
9297 SWT_CATCH |
|
9298 return POINTER_TO_HANDLE( calendar ); |
|
9299 } |
|
9300 |
|
9301 |
|
9302 JNIEXPORT void JNICALL OS_NATIVE( QDateTimeEdit_1setCalendarPopup ) |
|
9303 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEnable) |
|
9304 { |
|
9305 SWT_TRY |
|
9306 { |
|
9307 SWT_LOG_JNI_CALL(); |
|
9308 SWT_LOG_DATA_2("handle=%x enable=%d", aHandle, aEnable ); |
|
9309 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9310 editor->setCalendarPopup( aEnable ); |
|
9311 } |
|
9312 SWT_CATCH |
|
9313 } |
|
9314 |
|
9315 JNIEXPORT void JNICALL OS_NATIVE( QDateTimeEdit_1setDisplayFormat ) |
|
9316 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFormat) |
|
9317 { |
|
9318 SWT_TRY |
|
9319 { |
|
9320 SWT_LOG_JNI_CALL(); |
|
9321 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9322 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9323 editor->setDisplayFormat( swtApp->jniUtils().JavaStringToQString( aJniEnv, aFormat ) ); |
|
9324 } |
|
9325 SWT_CATCH |
|
9326 } |
|
9327 |
|
9328 JNIEXPORT jint JNICALL OS_NATIVE( QDateTimeEdit_1currentSectionIndex ) |
|
9329 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9330 { |
|
9331 jint index = 0; |
|
9332 SWT_TRY |
|
9333 { |
|
9334 SWT_LOG_JNI_CALL(); |
|
9335 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9336 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9337 index = editor->currentSectionIndex(); |
|
9338 } |
|
9339 SWT_CATCH |
|
9340 return index; |
|
9341 } |
|
9342 |
|
9343 JNIEXPORT jint JNICALL OS_NATIVE( QDateTimeEdit_1sectionCount ) |
|
9344 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9345 { |
|
9346 jint count = 0; |
|
9347 SWT_TRY |
|
9348 { |
|
9349 SWT_LOG_JNI_CALL(); |
|
9350 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9351 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9352 count = editor->sectionCount(); |
|
9353 } |
|
9354 SWT_CATCH |
|
9355 return count; |
|
9356 } |
|
9357 |
|
9358 |
|
9359 JNIEXPORT jintArray JNICALL OS_NATIVE( QDateTimeEdit_1swt_1dateTime ) |
|
9360 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9361 { |
|
9362 jintArray javaArray = NULL; |
|
9363 SWT_TRY |
|
9364 { |
|
9365 SWT_LOG_JNI_CALL(); |
|
9366 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
9367 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9368 |
|
9369 QDateTime dateTime = editor->dateTime(); |
|
9370 |
|
9371 QDate date = dateTime.date(); |
|
9372 QTime time = dateTime.time(); |
|
9373 int result[6] = {0,0,0,0,0,0}; |
|
9374 |
|
9375 result[0] = date.year(); |
|
9376 result[1] = date.month(); |
|
9377 result[2] = date.day(); |
|
9378 result[3] = time.hour(); |
|
9379 result[4] = time.minute(); |
|
9380 result[5] = time.second(); |
|
9381 |
|
9382 javaArray = swtApp->jniUtils().NewJavaIntArray( aJniEnv, result, 6 ); |
|
9383 } |
|
9384 SWT_CATCH |
|
9385 return javaArray; |
|
9386 } |
|
9387 |
|
9388 JNIEXPORT void JNICALL OS_NATIVE( QDateTimeEdit_1swt_1setDate ) |
|
9389 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aDate) |
|
9390 { |
|
9391 SWT_TRY |
|
9392 { |
|
9393 SWT_LOG_JNI_CALL(); |
|
9394 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9395 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9396 jint* dateArray = 0; |
|
9397 if (aDate != 0) |
|
9398 { |
|
9399 jboolean isCopy; |
|
9400 dateArray = aJniEnv->GetIntArrayElements( aDate, &isCopy ); |
|
9401 |
|
9402 if (dateArray != 0) |
|
9403 { |
|
9404 QDate date(dateArray[0], dateArray[1], dateArray[2]); |
|
9405 editor->setDate(date); |
|
9406 } |
|
9407 } |
|
9408 } |
|
9409 SWT_CATCH |
|
9410 } |
|
9411 |
|
9412 JNIEXPORT void JNICALL OS_NATIVE( QDateTimeEdit_1swt_1setTime ) |
|
9413 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aTime) |
|
9414 { |
|
9415 SWT_TRY |
|
9416 { |
|
9417 SWT_LOG_JNI_CALL(); |
|
9418 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9419 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9420 jint* timeArray = 0; |
|
9421 if (aTime != 0) |
|
9422 { |
|
9423 jboolean isCopy; |
|
9424 timeArray = aJniEnv->GetIntArrayElements( aTime, &isCopy ); |
|
9425 |
|
9426 if (timeArray != 0) |
|
9427 { |
|
9428 QTime time(timeArray[0], timeArray[1], timeArray[2]); |
|
9429 editor->setTime(time); |
|
9430 } |
|
9431 } |
|
9432 } |
|
9433 SWT_CATCH |
|
9434 } |
|
9435 |
|
9436 JNIEXPORT void JNICALL OS_NATIVE( QDateTimeEdit_1swt_1setDateTime ) |
|
9437 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aDateTime) |
|
9438 { |
|
9439 SWT_TRY |
|
9440 { |
|
9441 SWT_LOG_JNI_CALL(); |
|
9442 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9443 HANDLE_TO_POINTER( QDateTimeEdit*, editor, aHandle ); |
|
9444 jint* dateTimeArray = 0; |
|
9445 if (aDateTime != 0) |
|
9446 { |
|
9447 jboolean isCopy; |
|
9448 dateTimeArray = aJniEnv->GetIntArrayElements( aDateTime, &isCopy ); |
|
9449 |
|
9450 if (dateTimeArray != 0) |
|
9451 { |
|
9452 QDate date(dateTimeArray[0], dateTimeArray[1], dateTimeArray[2]); |
|
9453 QTime time(dateTimeArray[3], dateTimeArray[4], dateTimeArray[5]); |
|
9454 QDateTime dateTime(date, time, Qt::UTC); |
|
9455 editor->setDateTime(dateTime); |
|
9456 } |
|
9457 } |
|
9458 } |
|
9459 SWT_CATCH |
|
9460 } |
|
9461 |
|
9462 // |
|
9463 // QSwtTimeEdit |
|
9464 // |
|
9465 JNIEXPORT jint JNICALL OS_NATIVE( QSwtTimeEdit_1swt_1new ) |
|
9466 (JNIEnv* aJniEnv , jclass, jint aStyle) |
|
9467 { |
|
9468 QSwtTimeEdit* editor = NULL; |
|
9469 SWT_TRY |
|
9470 { |
|
9471 SWT_LOG_JNI_CALL(); |
|
9472 editor = new QSwtTimeEdit(); |
|
9473 |
|
9474 // Get default formatting for the editor from application locale for |
|
9475 // TIME, DATE and DATE_TIME styles. DURATION and OFFSET are handled |
|
9476 // on the Java side. |
|
9477 QLocale locale; |
|
9478 switch (aStyle) |
|
9479 { |
|
9480 case 1: // DATE |
|
9481 editor->setDisplayFormat(locale.dateFormat(QLocale::ShortFormat)); |
|
9482 editor->setTimeSpec( Qt::UTC ); |
|
9483 break; |
|
9484 case 2: // TIME |
|
9485 editor->setTimeRange(QTime(0,0,0), QTime(23,59,59)); |
|
9486 editor->setDisplayFormat(locale.timeFormat(QLocale::LongFormat)); |
|
9487 break; |
|
9488 case 3: // DATE_TIME |
|
9489 editor->setDisplayFormat(locale.dateTimeFormat(QLocale::ShortFormat)); |
|
9490 editor->setTimeSpec( Qt::UTC ); |
|
9491 break; |
|
9492 } |
|
9493 } |
|
9494 SWT_CATCH |
|
9495 return POINTER_TO_HANDLE( editor ); |
|
9496 } |
|
9497 |
|
9498 JNIEXPORT jint JNICALL OS_NATIVE( QSwtTimeEdit_1editor ) |
|
9499 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9500 { |
|
9501 jint editorHandle = 0; |
|
9502 SWT_TRY |
|
9503 { |
|
9504 SWT_LOG_JNI_CALL(); |
|
9505 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9506 HANDLE_TO_POINTER( QSwtTimeEdit*, editor, aHandle ); |
|
9507 editorHandle = POINTER_TO_HANDLE( editor->editor() ); |
|
9508 } |
|
9509 SWT_CATCH |
|
9510 return editorHandle; |
|
9511 } |
|
9512 |
|
9513 |
|
9514 JNIEXPORT jint JNICALL OS_NATIVE( QSwtTimeEdit_1cursorPosition ) |
|
9515 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9516 { |
|
9517 jint pos = 0; |
|
9518 SWT_TRY |
|
9519 { |
|
9520 SWT_LOG_JNI_CALL(); |
|
9521 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9522 HANDLE_TO_POINTER( QSwtTimeEdit*, editor, aHandle ); |
|
9523 pos = editor->cursorPosition(); |
|
9524 } |
|
9525 SWT_CATCH |
|
9526 return pos; |
|
9527 } |
|
9528 |
|
9529 |
|
9530 JNIEXPORT jint JNICALL OS_NATIVE( QSwtTimeEdit_1textLength ) |
|
9531 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9532 { |
|
9533 jint length = 0; |
|
9534 SWT_TRY |
|
9535 { |
|
9536 SWT_LOG_JNI_CALL(); |
|
9537 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9538 HANDLE_TO_POINTER( QSwtTimeEdit*, editor, aHandle ); |
|
9539 length = editor->textLength(); |
|
9540 } |
|
9541 SWT_CATCH |
|
9542 return length; |
|
9543 } |
|
9544 |
|
9545 JNIEXPORT void JNICALL OS_NATIVE( QSwtTimeEdit_1swt_1setTextVisible ) |
|
9546 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aEnable) |
|
9547 { |
|
9548 SWT_TRY |
|
9549 { |
|
9550 SWT_LOG_JNI_CALL(); |
|
9551 SWT_LOG_DATA_2("handle=%x enable=%x", aHandle, aEnable ); |
|
9552 HANDLE_TO_POINTER( QSwtTimeEdit*, editor, aHandle ); |
|
9553 editor->setTextVisible( aEnable ); |
|
9554 } |
|
9555 SWT_CATCH |
|
9556 } |
|
9557 |
|
9558 // |
|
9559 // QOffsetTimeEdit |
|
9560 // |
|
9561 |
|
9562 JNIEXPORT jint JNICALL OS_NATIVE( QOffsetTimeEdit_1new ) |
|
9563 (JNIEnv* aJniEnv , jclass) |
|
9564 { |
|
9565 QOffsetTimeEdit* editor = NULL; |
|
9566 SWT_TRY |
|
9567 { |
|
9568 SWT_LOG_JNI_CALL(); |
|
9569 editor = new QOffsetTimeEdit(); |
|
9570 } |
|
9571 SWT_CATCH |
|
9572 return POINTER_TO_HANDLE( editor ); |
|
9573 } |
|
9574 |
|
9575 JNIEXPORT jint JNICALL OS_NATIVE( QOffsetTimeEdit_1offset ) |
|
9576 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9577 { |
|
9578 jint offset = 0; |
|
9579 SWT_TRY |
|
9580 { |
|
9581 SWT_LOG_JNI_CALL(); |
|
9582 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9583 HANDLE_TO_POINTER( QOffsetTimeEdit*, editor, aHandle ); |
|
9584 offset = editor->getOffset(); |
|
9585 } |
|
9586 SWT_CATCH |
|
9587 return offset; |
|
9588 } |
|
9589 |
|
9590 JNIEXPORT void JNICALL OS_NATIVE( QOffsetTimeEdit_1setOffset ) |
|
9591 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aOffset) |
|
9592 { |
|
9593 SWT_TRY |
|
9594 { |
|
9595 SWT_LOG_JNI_CALL(); |
|
9596 SWT_LOG_DATA_2("handle=%x offset=%d", aHandle, aOffset ); |
|
9597 HANDLE_TO_POINTER( QOffsetTimeEdit*, editor, aHandle ); |
|
9598 editor->setOffset( aOffset ); |
|
9599 } |
|
9600 SWT_CATCH |
|
9601 } |
|
9602 |
|
9603 JNIEXPORT void JNICALL OS_NATIVE( QOffsetTimeEdit_1setMinimum ) |
|
9604 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMinimum) |
|
9605 { |
|
9606 SWT_TRY |
|
9607 { |
|
9608 SWT_LOG_JNI_CALL(); |
|
9609 SWT_LOG_DATA_2("handle=%x minimum=%d", aHandle, aMinimum ); |
|
9610 HANDLE_TO_POINTER( QOffsetTimeEdit*, editor, aHandle ); |
|
9611 editor->setMinimum( aMinimum ); |
|
9612 } |
|
9613 SWT_CATCH |
|
9614 } |
|
9615 |
|
9616 JNIEXPORT void JNICALL OS_NATIVE( QOffsetTimeEdit_1setMaximum ) |
|
9617 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMaximum) |
|
9618 { |
|
9619 SWT_TRY |
|
9620 { |
|
9621 SWT_LOG_JNI_CALL(); |
|
9622 SWT_LOG_DATA_2("handle=%x maximum=%d", aHandle, aMaximum ); |
|
9623 HANDLE_TO_POINTER( QOffsetTimeEdit*, editor, aHandle ); |
|
9624 editor->setMaximum( aMaximum ); |
|
9625 } |
|
9626 SWT_CATCH |
|
9627 } |
|
9628 |
|
9629 // |
|
9630 // QProgressDialog |
|
9631 // |
|
9632 JNIEXPORT jint JNICALL OS_NATIVE( QProgressDialog_1swt_1new ) |
|
9633 (JNIEnv* aJniEnv , jclass, jint aParentHandle, jboolean aShowBar ) |
|
9634 { |
|
9635 QProgressDialog* dialog = NULL; |
|
9636 SWT_TRY |
|
9637 { |
|
9638 SWT_LOG_JNI_CALL(); |
|
9639 HANDLE_TO_POINTER( QWidget*, parent, aParentHandle ); |
|
9640 dialog = new QProgressDialog( parent, Qt::ToolTip ); |
|
9641 if (!aShowBar) |
|
9642 { |
|
9643 // Create a custom TaskTipBar whose preferred size |
|
9644 // is (0,0) and then set it to the dialog to make |
|
9645 // ProgressBar disappear |
|
9646 QTaskTipBar* bar = new QTaskTipBar(dialog); |
|
9647 dialog->setBar(bar); |
|
9648 } |
|
9649 } |
|
9650 SWT_CATCH |
|
9651 return POINTER_TO_HANDLE( dialog ); |
|
9652 } |
|
9653 |
|
9654 JNIEXPORT jint JNICALL OS_NATIVE( QProgressDialog_1maximum ) |
|
9655 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9656 { |
|
9657 jint maximum = 0; |
|
9658 SWT_TRY |
|
9659 { |
|
9660 SWT_LOG_JNI_CALL(); |
|
9661 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9662 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9663 maximum = dialog->maximum(); |
|
9664 } |
|
9665 SWT_CATCH |
|
9666 return maximum; |
|
9667 } |
|
9668 |
|
9669 JNIEXPORT jint JNICALL OS_NATIVE( QProgressDialog_1minimum ) |
|
9670 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9671 { |
|
9672 jint minimum = 0; |
|
9673 SWT_TRY |
|
9674 { |
|
9675 SWT_LOG_JNI_CALL(); |
|
9676 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9677 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9678 minimum = dialog->minimum(); |
|
9679 } |
|
9680 SWT_CATCH |
|
9681 return minimum; |
|
9682 } |
|
9683 |
|
9684 JNIEXPORT jint JNICALL OS_NATIVE( QProgressDialog_1value ) |
|
9685 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
9686 { |
|
9687 jint value = 0; |
|
9688 SWT_TRY |
|
9689 { |
|
9690 SWT_LOG_JNI_CALL(); |
|
9691 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9692 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9693 value = dialog->value(); |
|
9694 } |
|
9695 SWT_CATCH |
|
9696 return value; |
|
9697 } |
|
9698 |
|
9699 |
|
9700 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setAutoClose ) |
|
9701 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aClose) |
|
9702 { |
|
9703 SWT_TRY |
|
9704 { |
|
9705 SWT_LOG_JNI_CALL(); |
|
9706 SWT_LOG_DATA_2("handle=%x close=%d", aHandle, aClose ); |
|
9707 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9708 dialog->setAutoClose( aClose ); |
|
9709 } |
|
9710 SWT_CATCH |
|
9711 } |
|
9712 |
|
9713 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setAutoReset ) |
|
9714 (JNIEnv* aJniEnv , jclass, jint aHandle, jboolean aReset) |
|
9715 { |
|
9716 SWT_TRY |
|
9717 { |
|
9718 SWT_LOG_JNI_CALL(); |
|
9719 SWT_LOG_DATA_2("handle=%x reset=%d", aHandle, aReset ); |
|
9720 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9721 dialog->setAutoReset( aReset ); |
|
9722 } |
|
9723 SWT_CATCH |
|
9724 } |
|
9725 |
|
9726 |
|
9727 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setMaximum ) |
|
9728 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMaximum) |
|
9729 { |
|
9730 SWT_TRY |
|
9731 { |
|
9732 SWT_LOG_JNI_CALL(); |
|
9733 SWT_LOG_DATA_2("handle=%x maximum=%d", aHandle, aMaximum ); |
|
9734 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9735 dialog->setMaximum( aMaximum ); |
|
9736 } |
|
9737 SWT_CATCH |
|
9738 } |
|
9739 |
|
9740 |
|
9741 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setMinimum ) |
|
9742 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMinimum) |
|
9743 { |
|
9744 SWT_TRY |
|
9745 { |
|
9746 SWT_LOG_JNI_CALL(); |
|
9747 SWT_LOG_DATA_2("handle=%x minimum=%d", aHandle, aMinimum ); |
|
9748 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9749 dialog->setMinimum( aMinimum ); |
|
9750 } |
|
9751 SWT_CATCH |
|
9752 } |
|
9753 |
|
9754 |
|
9755 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setValue ) |
|
9756 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aValue) |
|
9757 { |
|
9758 SWT_TRY |
|
9759 { |
|
9760 SWT_LOG_JNI_CALL(); |
|
9761 SWT_LOG_DATA_2("handle=%x value=%d", aHandle, aValue ); |
|
9762 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9763 dialog->setValue( aValue ); |
|
9764 } |
|
9765 SWT_CATCH |
|
9766 } |
|
9767 |
|
9768 |
|
9769 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setLabelText ) |
|
9770 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aText) |
|
9771 { |
|
9772 SWT_TRY |
|
9773 { |
|
9774 SWT_LOG_JNI_CALL(); |
|
9775 SWT_LOG_DATA_1("handle=%x", aHandle ); |
|
9776 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9777 dialog->setLabelText( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
9778 } |
|
9779 SWT_CATCH |
|
9780 } |
|
9781 |
|
9782 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setBar ) |
|
9783 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBarHandle) |
|
9784 { |
|
9785 SWT_TRY |
|
9786 { |
|
9787 SWT_LOG_JNI_CALL(); |
|
9788 SWT_LOG_DATA_2("handle=%x barHande=%x", aHandle, aBarHandle ); |
|
9789 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9790 HANDLE_TO_POINTER( QProgressBar*, bar, aBarHandle ); |
|
9791 dialog->setBar( bar ); |
|
9792 } |
|
9793 SWT_CATCH |
|
9794 } |
|
9795 |
|
9796 JNIEXPORT void JNICALL OS_NATIVE( QProgressDialog_1setCancelButton ) |
|
9797 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aButtonHandle) |
|
9798 { |
|
9799 SWT_TRY |
|
9800 { |
|
9801 SWT_LOG_JNI_CALL(); |
|
9802 SWT_LOG_DATA_2("handle=%x buttonHande=%x", aHandle, aButtonHandle ); |
|
9803 HANDLE_TO_POINTER( QProgressDialog*, dialog, aHandle ); |
|
9804 HANDLE_TO_POINTER( QPushButton*, button, aButtonHandle ); |
|
9805 dialog->setCancelButton( button ); |
|
9806 } |
|
9807 SWT_CATCH |
|
9808 } |
|
9809 |
|
9810 |
|
9811 // |
|
9812 JNIEXPORT jint JNICALL OS_NATIVE( QEvent_1new ) |
|
9813 (JNIEnv* aJniEnv , jclass, jint aType) |
|
9814 { |
|
9815 QEvent* event = NULL; |
|
9816 SWT_TRY |
|
9817 { |
|
9818 SWT_LOG_JNI_CALL(); |
|
9819 SWT_LOG_DATA_1("type=%d", aType); |
|
9820 |
|
9821 // Ownership is passed to the caller |
|
9822 event = new QEvent( static_cast<QEvent::Type>( aType ) ); |
|
9823 } |
|
9824 SWT_CATCH |
|
9825 QEvent* handle = static_cast<QEvent*>( event ); |
|
9826 return reinterpret_cast<jint>( handle ); |
|
9827 } |
|
9828 // QMouseEvent |
|
9829 // |
|
9830 |
|
9831 JNIEXPORT jint JNICALL OS_NATIVE( QMouseEvent_1new ) |
|
9832 (JNIEnv* aJniEnv , jclass, jint aType, jint aXPos, jint aYPos, jint aXGlobalPos, jint aYGlobalPos, jint aButton, jint aButtons, jint aModifiers) |
|
9833 { |
|
9834 QMouseEvent* event = NULL; |
|
9835 SWT_TRY |
|
9836 { |
|
9837 SWT_LOG_JNI_CALL(); |
|
9838 SWT_LOG_DATA_1("type=%d", aType); |
|
9839 |
|
9840 // Ownership is passed to the caller |
|
9841 event = new QMouseEvent( static_cast<QEvent::Type>( aType ), |
|
9842 QPoint( aXPos, aYPos ), |
|
9843 QPoint( aXGlobalPos, aYGlobalPos ), |
|
9844 static_cast<Qt::MouseButton>( aButton ), |
|
9845 static_cast<Qt::MouseButtons>( aButtons ), |
|
9846 static_cast<Qt::KeyboardModifiers>( aModifiers ) ); |
|
9847 } |
|
9848 SWT_CATCH |
|
9849 // Not a QObject |
|
9850 QEvent* handle = static_cast<QEvent*>( event ); |
|
9851 return reinterpret_cast<jint>( handle ); |
|
9852 } |
|
9853 |
|
9854 // |
|
9855 // QKeyEvent |
|
9856 // |
|
9857 |
|
9858 JNIEXPORT jint JNICALL OS_NATIVE( QKeyEvent_1new ) |
|
9859 (JNIEnv* aJniEnv , jclass, jint aType, jint aKey, jint aModifiers, jstring aText) |
|
9860 { |
|
9861 QKeyEvent* event = NULL; |
|
9862 SWT_TRY |
|
9863 { |
|
9864 SWT_LOG_JNI_CALL(); |
|
9865 SWT_LOG_DATA_1("type=%d", aType); |
|
9866 |
|
9867 // Ownership is passed to the caller |
|
9868 event = new QKeyEvent( static_cast<QEvent::Type>( aType ), |
|
9869 aKey, |
|
9870 static_cast<Qt::KeyboardModifiers>( aModifiers ), |
|
9871 swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
9872 } |
|
9873 SWT_CATCH |
|
9874 // Not a QObject |
|
9875 QEvent* handle = static_cast<QEvent*>( event ); |
|
9876 return reinterpret_cast<jint>( handle ); |
|
9877 } |
|
9878 |
|
9879 // |
|
9880 // QCaptionedWidget |
|
9881 // |
|
9882 |
|
9883 JNIEXPORT jint JNICALL OS_NATIVE( QCaptionedWidget_1new ) |
|
9884 ( JNIEnv* aJniEnv , jclass ) |
|
9885 { |
|
9886 QCaptionedWidget* widget = NULL; |
|
9887 SWT_TRY |
|
9888 { |
|
9889 SWT_LOG_JNI_CALL(); |
|
9890 widget = new QCaptionedWidget; |
|
9891 } |
|
9892 SWT_CATCH |
|
9893 return POINTER_TO_HANDLE( widget ); |
|
9894 } |
|
9895 |
|
9896 |
|
9897 |
|
9898 // |
|
9899 // QMessageBox |
|
9900 // |
|
9901 JNIEXPORT jint JNICALL OS_NATIVE(QMessageBox_1swt_1exec) |
|
9902 (JNIEnv* aJniEnv , jclass, jint aIcon, jstring aTitle, jstring aText, |
|
9903 jint aButtons, jint aParent, jint aModality, jstring aDialogID, jint aLayoutDirection) |
|
9904 { |
|
9905 jint retValue = 0; |
|
9906 SWT_TRY |
|
9907 { |
|
9908 SWT_LOG_JNI_CALL(); |
|
9909 SWT_LOG_DATA_5("dialogID=%s, parent=%x icon=%d, buttons=%x, modality=%d", aDialogID, aParent, aIcon, aButtons, aModality); |
|
9910 HANDLE_TO_POINTER(QWidget*, parent, aParent); |
|
9911 QMessageBox msgBox( static_cast<QMessageBox::Icon>(aIcon), |
|
9912 swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle), |
|
9913 swtApp->jniUtils().JavaStringToQString(aJniEnv, aText), |
|
9914 static_cast<QMessageBox::StandardButtons>(aButtons), |
|
9915 parent ); |
|
9916 msgBox.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID) ); |
|
9917 msgBox.setWindowModality( static_cast<Qt::WindowModality>(aModality) ); |
|
9918 msgBox.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
9919 AutoPopExecStack stackExec(&msgBox); |
|
9920 retValue = static_cast<jint>(msgBox.exec()); |
|
9921 } |
|
9922 SWT_CATCH |
|
9923 return retValue; |
|
9924 } |
|
9925 |
|
9926 JNIEXPORT void JNICALL OS_NATIVE(QMessageBox_1swt_1execTimer) |
|
9927 (JNIEnv* aJniEnv , jclass, jint aIcon, jstring aTitle, jstring aText, |
|
9928 jint aParent, jstring aDialogID, jint aLayoutDirection, jint aModality, jint aPixmapHandle) |
|
9929 { |
|
9930 SWT_TRY |
|
9931 { |
|
9932 // Define event filter which closes QMessageBox |
|
9933 // on any key press or mouse button release events. |
|
9934 class TimedMsgBoxEventFilter : public QObject |
|
9935 { |
|
9936 public: |
|
9937 TimedMsgBoxEventFilter(QMessageBox& aMsgBox) : |
|
9938 QObject(), msgBox(aMsgBox) |
|
9939 { |
|
9940 QObjectList list = aMsgBox.children(); |
|
9941 int count = list.count(); |
|
9942 for (int i = 0; i < count; ++i) |
|
9943 { |
|
9944 list.at(i)->installEventFilter(this); |
|
9945 } |
|
9946 aMsgBox.installEventFilter(this); |
|
9947 } |
|
9948 |
|
9949 virtual bool eventFilter(QObject* /*aObject*/, QEvent* aEvent) |
|
9950 { |
|
9951 if (aEvent->type() == QEvent::KeyPress || |
|
9952 aEvent->type() == QEvent::MouseButtonRelease) |
|
9953 { |
|
9954 msgBox.reject(); |
|
9955 return true; |
|
9956 } |
|
9957 return false; |
|
9958 } |
|
9959 private: |
|
9960 QMessageBox& msgBox; |
|
9961 }; |
|
9962 |
|
9963 |
|
9964 SWT_LOG_JNI_CALL(); |
|
9965 SWT_LOG_DATA_5("dialogID=%s, parent=%x icon=%d, pixmap=%x, modality=%d", aDialogID, aParent, aIcon, aPixmapHandle, aModality); |
|
9966 HANDLE_TO_POINTER(QWidget*, parent, aParent); |
|
9967 |
|
9968 QMessageBox msgBox( static_cast<QMessageBox::Icon>(aIcon), |
|
9969 swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle), |
|
9970 swtApp->jniUtils().JavaStringToQString(aJniEnv, aText), |
|
9971 QMessageBox::NoButton, |
|
9972 parent ); |
|
9973 |
|
9974 // Following call is needed to hide the auto-added OK button |
|
9975 msgBox.setStandardButtons(QMessageBox::NoButton); |
|
9976 msgBox.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID) ); |
|
9977 msgBox.setWindowModality( static_cast<Qt::WindowModality>(aModality) ); |
|
9978 msgBox.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
9979 |
|
9980 if (aPixmapHandle) { |
|
9981 msgBox.setIconPixmap( *reinterpret_cast<QPixmap*>(aPixmapHandle) ); |
|
9982 } |
|
9983 |
|
9984 TimedMsgBoxEventFilter filter(msgBox); |
|
9985 QTimer::singleShot(KTimedMessageBoxTimeout, &msgBox, SLOT(reject())); |
|
9986 AutoPopExecStack stackExec(&msgBox); |
|
9987 msgBox.exec(); |
|
9988 } |
|
9989 SWT_CATCH |
|
9990 } |
|
9991 |
|
9992 |
|
9993 // |
|
9994 // QInputDialog |
|
9995 // |
|
9996 |
|
9997 |
|
9998 JNIEXPORT jstring JNICALL OS_NATIVE(QInputDialog_1swt_1getText) |
|
9999 (JNIEnv* aJniEnv , jclass, jint aParentHandle, jstring aTitle, jstring aLabel, jint aEchoMode, jstring aDefaultText, jstring aDialogId, jint aLayoutDirection) |
|
10000 { |
|
10001 jstring text = NULL; |
|
10002 SWT_TRY |
|
10003 { |
|
10004 SWT_LOG_JNI_CALL(); |
|
10005 SWT_LOG_DATA_3("parent handle=%x echo mode=%d layoutDirection=%d", aParentHandle, aEchoMode, aLayoutDirection); |
|
10006 HANDLE_TO_POINTER(QWidget*, parent, aParentHandle); |
|
10007 QInputDialog dialog(parent); |
|
10008 dialog.setObjectName(swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogId)); |
|
10009 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
10010 dialog.setInputMode(QInputDialog::TextInput); |
|
10011 dialog.setWindowTitle(swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle)); |
|
10012 dialog.setLabelText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aLabel)); |
|
10013 dialog.setTextEchoMode(static_cast<QLineEdit::EchoMode>(aEchoMode)); |
|
10014 dialog.setTextValue(swtApp->jniUtils().JavaStringToQString(aJniEnv, aDefaultText)); |
|
10015 AutoPopExecStack stackExec(&dialog); |
|
10016 int result = dialog.exec(); |
|
10017 if (result == QDialog::Accepted) |
|
10018 { |
|
10019 text = swtApp->jniUtils().QStringToJavaString(aJniEnv, dialog.textValue()); |
|
10020 } |
|
10021 } |
|
10022 SWT_CATCH |
|
10023 return text; |
|
10024 } |
|
10025 |
|
10026 |
|
10027 JNIEXPORT jstring JNICALL OS_NATIVE(QInputDialog_1swt_1getDouble) |
|
10028 (JNIEnv* aJniEnv , jclass, jint aParentHandle, jstring aTitle, jstring aLabel, |
|
10029 jdouble aMin, jdouble aMax, jdouble aDefaultValue, jint aDecimals, jstring aDialogId, jint aLayoutDirection) |
|
10030 { |
|
10031 jstring doubleString = NULL; |
|
10032 SWT_TRY |
|
10033 { |
|
10034 SWT_LOG_JNI_CALL(); |
|
10035 SWT_LOG_DATA_5("parent handle=%x min=%e, max=%e, default=%e, decimals=%d layoutDirection=%d", |
|
10036 aParentHandle, aMin, aMax, aDefaultValue, aDecimals); |
|
10037 HANDLE_TO_POINTER(QWidget*, parent, aParentHandle); |
|
10038 QInputDialog dialog(parent); |
|
10039 dialog.setObjectName(swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogId)); |
|
10040 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
10041 dialog.setInputMode(QInputDialog::DoubleInput); |
|
10042 dialog.setWindowTitle(swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle)); |
|
10043 dialog.setLabelText(swtApp->jniUtils().JavaStringToQString(aJniEnv, aLabel)); |
|
10044 dialog.setDoubleRange(aMin, aMax); |
|
10045 dialog.setDoubleDecimals(aDecimals); |
|
10046 // Order of this call matters, causes problems if done before setting range |
|
10047 dialog.setDoubleValue(aDefaultValue); |
|
10048 AutoPopExecStack stackExec(&dialog); |
|
10049 int result = dialog.exec(); |
|
10050 if (result == QDialog::Accepted) |
|
10051 { |
|
10052 QString str = QString("%1").arg(dialog.doubleValue(), 0 , 'f', aDecimals); |
|
10053 doubleString = swtApp->jniUtils().QStringToJavaString(aJniEnv, str); |
|
10054 } |
|
10055 } |
|
10056 SWT_CATCH |
|
10057 return doubleString; |
|
10058 } |
|
10059 |
|
10060 |
|
10061 // |
|
10062 // QVBoxLayout |
|
10063 // |
|
10064 |
|
10065 JNIEXPORT jint JNICALL OS_NATIVE( QVBoxLayout_1new ) |
|
10066 ( JNIEnv* aJniEnv , jclass, jint aParent ) |
|
10067 { |
|
10068 QVBoxLayout* layout = NULL; |
|
10069 SWT_TRY |
|
10070 { |
|
10071 SWT_LOG_JNI_CALL(); |
|
10072 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
10073 layout = new QVBoxLayout( parent ); |
|
10074 } |
|
10075 SWT_CATCH |
|
10076 return POINTER_TO_HANDLE( layout ); |
|
10077 } |
|
10078 |
|
10079 |
|
10080 // |
|
10081 // QLayout |
|
10082 // |
|
10083 |
|
10084 JNIEXPORT void JNICALL OS_NATIVE( QLayout_1addWidget ) |
|
10085 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidget ) |
|
10086 { |
|
10087 SWT_TRY |
|
10088 { |
|
10089 SWT_LOG_JNI_CALL(); |
|
10090 SWT_LOG_DATA_2("handle=%x widget=%d", aHandle, aWidget); |
|
10091 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10092 HANDLE_TO_POINTER( QWidget*, widget, aWidget ); |
|
10093 layout->addWidget( widget ); |
|
10094 } |
|
10095 SWT_CATCH |
|
10096 } |
|
10097 |
|
10098 JNIEXPORT void JNICALL OS_NATIVE( QLayout_1setContentsMargins ) |
|
10099 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aLeft, jint aTop, jint aRight, jint aBottom ) |
|
10100 { |
|
10101 SWT_TRY |
|
10102 { |
|
10103 SWT_LOG_JNI_CALL(); |
|
10104 SWT_LOG_DATA_5("handle=%x left=%d top=%d right=%d bottom=%d", aHandle, aLeft, aTop, aRight, aBottom); |
|
10105 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10106 layout->setContentsMargins( aLeft, aTop, aRight, aBottom ); |
|
10107 } |
|
10108 SWT_CATCH |
|
10109 } |
|
10110 JNIEXPORT void JNICALL OS_NATIVE( QLayout_1setMenuBar ) |
|
10111 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aMenuBar ) |
|
10112 { |
|
10113 SWT_TRY |
|
10114 { |
|
10115 SWT_LOG_JNI_CALL(); |
|
10116 SWT_LOG_DATA_2( "handle=%x menubar=%d", aHandle, aMenuBar ); |
|
10117 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10118 HANDLE_TO_POINTER( QWidget*, widget, aMenuBar ); |
|
10119 layout->setMenuBar( widget ); |
|
10120 } |
|
10121 SWT_CATCH |
|
10122 } |
|
10123 |
|
10124 JNIEXPORT void JNICALL OS_NATIVE( QLayout_1setSpacing ) |
|
10125 ( JNIEnv* aJniEnv , jclass, jint aHandle, jint aSpacing ) |
|
10126 { |
|
10127 SWT_TRY |
|
10128 { |
|
10129 SWT_LOG_JNI_CALL(); |
|
10130 SWT_LOG_DATA_2( "handle=%x spacing=%d", aHandle, aSpacing ); |
|
10131 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10132 layout->setSpacing( aSpacing ); |
|
10133 } |
|
10134 SWT_CATCH |
|
10135 } |
|
10136 |
|
10137 JNIEXPORT jboolean JNICALL OS_NATIVE( QLayout_1activate ) |
|
10138 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
10139 { |
|
10140 bool result = false; |
|
10141 SWT_TRY |
|
10142 { |
|
10143 SWT_LOG_JNI_CALL(); |
|
10144 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10145 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10146 result = layout->activate(); |
|
10147 } |
|
10148 SWT_CATCH |
|
10149 return (result ? JNI_TRUE : JNI_FALSE); |
|
10150 } |
|
10151 |
|
10152 JNIEXPORT void JNICALL OS_NATIVE( QLayout_1update ) |
|
10153 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
10154 { |
|
10155 SWT_TRY |
|
10156 { |
|
10157 SWT_LOG_JNI_CALL(); |
|
10158 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10159 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10160 layout->update(); |
|
10161 } |
|
10162 SWT_CATCH |
|
10163 } |
|
10164 |
|
10165 JNIEXPORT jint JNICALL OS_NATIVE( QLayout_1sizeConstraint ) |
|
10166 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
10167 { |
|
10168 jint result = 0; |
|
10169 SWT_TRY |
|
10170 { |
|
10171 SWT_LOG_JNI_CALL(); |
|
10172 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10173 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10174 result = layout->sizeConstraint(); |
|
10175 } |
|
10176 SWT_CATCH |
|
10177 return result; |
|
10178 } |
|
10179 |
|
10180 JNIEXPORT void JNICALL OS_NATIVE( QLayout_1setSizeConstraint ) |
|
10181 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aConstraint) |
|
10182 { |
|
10183 SWT_TRY |
|
10184 { |
|
10185 SWT_LOG_JNI_CALL(); |
|
10186 SWT_LOG_DATA_2("handle=%x constraint=%x", aHandle, aConstraint); |
|
10187 HANDLE_TO_POINTER( QLayout*, layout, aHandle ); |
|
10188 layout->setSizeConstraint((QLayout::SizeConstraint)aConstraint); |
|
10189 } |
|
10190 SWT_CATCH |
|
10191 } |
|
10192 |
|
10193 // |
|
10194 // QDesktopServices |
|
10195 // |
|
10196 JNIEXPORT jboolean JNICALL OS_NATIVE( QDesktopServices_1openUrl ) |
|
10197 (JNIEnv* aJniEnv , jclass, jstring aUrl) |
|
10198 { |
|
10199 bool result = false; |
|
10200 #ifndef QT_NO_DESKTOPSERVICES |
|
10201 SWT_TRY |
|
10202 { |
|
10203 SWT_LOG_JNI_CALL(); |
|
10204 QString url = swtApp->jniUtils().JavaStringToQString( aJniEnv, aUrl ); |
|
10205 SWT_LOG_DATA_1( "call QDesktopSrvices::openUrl %d", 0 ); |
|
10206 result = QDesktopServices::openUrl( QUrl( url ) ); |
|
10207 } |
|
10208 SWT_CATCH |
|
10209 #endif |
|
10210 return ( result ? JNI_TRUE : JNI_FALSE ); |
|
10211 } |
|
10212 |
|
10213 |
|
10214 // |
|
10215 // QWebView |
|
10216 // |
|
10217 JNIEXPORT jint JNICALL OS_NATIVE( QWebView_1new ) |
|
10218 ( JNIEnv* aJniEnv , jclass ) |
|
10219 { |
|
10220 #ifndef QT_NO_WEBKIT |
|
10221 QWebView* browser = NULL; |
|
10222 SWT_TRY |
|
10223 { |
|
10224 SWT_LOG_JNI_CALL(); |
|
10225 browser = new QWebView(); |
|
10226 } |
|
10227 SWT_CATCH |
|
10228 return POINTER_TO_HANDLE( browser ); |
|
10229 #endif |
|
10230 #ifdef QT_NO_WEBKIT |
|
10231 swtApp->jniUtils().Throw( aJniEnv, ESwtErrorNotImplemented ); |
|
10232 return 0; |
|
10233 #endif |
|
10234 } |
|
10235 |
|
10236 JNIEXPORT void JNICALL OS_NATIVE( QWebView_1back ) |
|
10237 ( JNIEnv* aJniEnv , jclass, jint |
|
10238 #ifndef QT_NO_WEBKIT |
|
10239 aHandle |
|
10240 #endif |
|
10241 ) |
|
10242 { |
|
10243 SWT_TRY |
|
10244 { |
|
10245 SWT_LOG_JNI_CALL(); |
|
10246 #ifndef QT_NO_WEBKIT |
|
10247 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10248 browser->back(); |
|
10249 #endif |
|
10250 } |
|
10251 SWT_CATCH |
|
10252 } |
|
10253 |
|
10254 JNIEXPORT void JNICALL OS_NATIVE( QWebView_1forward ) |
|
10255 ( JNIEnv* aJniEnv , jclass, jint |
|
10256 #ifndef QT_NO_WEBKIT |
|
10257 aHandle |
|
10258 #endif |
|
10259 ) |
|
10260 { |
|
10261 SWT_TRY |
|
10262 { |
|
10263 SWT_LOG_JNI_CALL(); |
|
10264 #ifndef QT_NO_WEBKIT |
|
10265 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10266 browser->forward(); |
|
10267 #endif |
|
10268 } |
|
10269 SWT_CATCH |
|
10270 } |
|
10271 |
|
10272 JNIEXPORT void JNICALL OS_NATIVE( QWebView_1reload ) |
|
10273 ( JNIEnv* aJniEnv , jclass, jint |
|
10274 #ifndef QT_NO_WEBKIT |
|
10275 aHandle |
|
10276 #endif |
|
10277 ) |
|
10278 { |
|
10279 SWT_TRY |
|
10280 { |
|
10281 SWT_LOG_JNI_CALL(); |
|
10282 #ifndef QT_NO_WEBKIT |
|
10283 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10284 browser->reload(); |
|
10285 #endif |
|
10286 } |
|
10287 SWT_CATCH |
|
10288 } |
|
10289 |
|
10290 JNIEXPORT void JNICALL OS_NATIVE( QWebView_1setHtml ) |
|
10291 ( JNIEnv* aJniEnv , jclass, jint |
|
10292 #ifndef QT_NO_WEBKIT |
|
10293 aHandle |
|
10294 #endif |
|
10295 , jstring |
|
10296 #ifndef QT_NO_WEBKIT |
|
10297 aText |
|
10298 #endif |
|
10299 ) |
|
10300 { |
|
10301 SWT_TRY |
|
10302 { |
|
10303 SWT_LOG_JNI_CALL(); |
|
10304 #ifndef QT_NO_WEBKIT |
|
10305 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10306 browser->setHtml( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
10307 #endif |
|
10308 } |
|
10309 SWT_CATCH |
|
10310 } |
|
10311 |
|
10312 JNIEXPORT void JNICALL OS_NATIVE( QWebView_1setUrl ) |
|
10313 ( JNIEnv* aJniEnv , jclass, jint |
|
10314 #ifndef QT_NO_WEBKIT |
|
10315 aHandle |
|
10316 #endif |
|
10317 , jstring |
|
10318 #ifndef QT_NO_WEBKIT |
|
10319 aText |
|
10320 #endif |
|
10321 ) |
|
10322 { |
|
10323 SWT_TRY |
|
10324 { |
|
10325 SWT_LOG_JNI_CALL(); |
|
10326 #ifndef QT_NO_WEBKIT |
|
10327 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10328 browser->setUrl( QUrl( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ) ); |
|
10329 #endif |
|
10330 } |
|
10331 SWT_CATCH |
|
10332 } |
|
10333 |
|
10334 JNIEXPORT void JNICALL OS_NATIVE( QWebView_1stop ) |
|
10335 ( JNIEnv* aJniEnv , jclass, jint |
|
10336 #ifndef QT_NO_WEBKIT |
|
10337 aHandle |
|
10338 #endif |
|
10339 ) |
|
10340 { |
|
10341 SWT_TRY |
|
10342 { |
|
10343 SWT_LOG_JNI_CALL(); |
|
10344 #ifndef QT_NO_WEBKIT |
|
10345 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10346 browser->stop(); |
|
10347 #endif |
|
10348 } |
|
10349 SWT_CATCH |
|
10350 } |
|
10351 |
|
10352 JNIEXPORT jstring JNICALL OS_NATIVE( QWebView_1swt_1backUrl ) |
|
10353 ( JNIEnv* aJniEnv , jclass, jint |
|
10354 #ifndef QT_NO_WEBKIT |
|
10355 aHandle |
|
10356 #endif |
|
10357 ) |
|
10358 { |
|
10359 jstring res = NULL; |
|
10360 SWT_TRY |
|
10361 { |
|
10362 SWT_LOG_JNI_CALL(); |
|
10363 #ifndef QT_NO_WEBKIT |
|
10364 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10365 QWebHistory* history = browser->history(); |
|
10366 if ( history && history->canGoBack() ) |
|
10367 { |
|
10368 res = swtApp->jniUtils().QStringToJavaString( aJniEnv, history->backItem().url().toString() ); |
|
10369 } |
|
10370 #endif |
|
10371 } |
|
10372 SWT_CATCH |
|
10373 return res; |
|
10374 } |
|
10375 |
|
10376 JNIEXPORT jboolean JNICALL OS_NATIVE( QWebView_1swt_1canGoBack ) |
|
10377 ( JNIEnv* aJniEnv , jclass, jint |
|
10378 #ifndef QT_NO_WEBKIT |
|
10379 aHandle |
|
10380 #endif |
|
10381 ) |
|
10382 { |
|
10383 jboolean res = false; |
|
10384 SWT_TRY |
|
10385 { |
|
10386 SWT_LOG_JNI_CALL(); |
|
10387 #ifndef QT_NO_WEBKIT |
|
10388 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10389 QWebHistory* history = browser->history(); |
|
10390 if ( history ) |
|
10391 { |
|
10392 res = history->canGoBack(); |
|
10393 } |
|
10394 #endif |
|
10395 } |
|
10396 SWT_CATCH |
|
10397 return res; |
|
10398 } |
|
10399 |
|
10400 JNIEXPORT jboolean JNICALL OS_NATIVE( QWebView_1swt_1canGoForward ) |
|
10401 ( JNIEnv* aJniEnv , jclass, jint |
|
10402 #ifndef QT_NO_WEBKIT |
|
10403 aHandle |
|
10404 #endif |
|
10405 ) |
|
10406 { |
|
10407 jboolean res = false; |
|
10408 SWT_TRY |
|
10409 { |
|
10410 SWT_LOG_JNI_CALL(); |
|
10411 #ifndef QT_NO_WEBKIT |
|
10412 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10413 QWebHistory* history = browser->history(); |
|
10414 if ( history ) |
|
10415 { |
|
10416 res = history->canGoForward(); |
|
10417 } |
|
10418 #endif |
|
10419 } |
|
10420 SWT_CATCH |
|
10421 return res; |
|
10422 } |
|
10423 |
|
10424 JNIEXPORT jboolean JNICALL OS_NATIVE( QWebView_1swt_1evaluateJavaScript ) |
|
10425 ( JNIEnv* aJniEnv , jclass, jint |
|
10426 #ifndef QT_NO_WEBKIT |
|
10427 aHandle |
|
10428 #endif |
|
10429 , jstring |
|
10430 #ifndef QT_NO_WEBKIT |
|
10431 aText |
|
10432 #endif |
|
10433 ) |
|
10434 { |
|
10435 jboolean res = false; |
|
10436 SWT_TRY |
|
10437 { |
|
10438 SWT_LOG_JNI_CALL(); |
|
10439 #ifndef QT_NO_WEBKIT |
|
10440 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10441 QWebPage* page = browser->page(); |
|
10442 if ( page ) |
|
10443 { |
|
10444 QWebFrame* frame = page->currentFrame(); |
|
10445 if ( !frame ) |
|
10446 { |
|
10447 frame = page->mainFrame(); |
|
10448 } |
|
10449 if ( frame ) |
|
10450 { |
|
10451 res = ( frame->evaluateJavaScript( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ) ).toBool(); |
|
10452 } |
|
10453 } |
|
10454 #endif |
|
10455 } |
|
10456 SWT_CATCH |
|
10457 return res; |
|
10458 } |
|
10459 |
|
10460 JNIEXPORT jstring JNICALL OS_NATIVE( QWebView_1swt_1forwardUrl ) |
|
10461 ( JNIEnv* aJniEnv , jclass, jint |
|
10462 #ifndef QT_NO_WEBKIT |
|
10463 aHandle |
|
10464 #endif |
|
10465 ) |
|
10466 { |
|
10467 jstring res = NULL; |
|
10468 SWT_TRY |
|
10469 { |
|
10470 SWT_LOG_JNI_CALL(); |
|
10471 #ifndef QT_NO_WEBKIT |
|
10472 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10473 QWebHistory* history = browser->history(); |
|
10474 if ( history && history->canGoForward() ) |
|
10475 { |
|
10476 res = swtApp->jniUtils().QStringToJavaString( aJniEnv, history->forwardItem().url().toString() ); |
|
10477 } |
|
10478 #endif |
|
10479 } |
|
10480 SWT_CATCH |
|
10481 return res; |
|
10482 } |
|
10483 |
|
10484 JNIEXPORT jstring JNICALL OS_NATIVE( QWebView_1url ) |
|
10485 ( JNIEnv* aJniEnv , jclass, jint |
|
10486 #ifndef QT_NO_WEBKIT |
|
10487 aHandle |
|
10488 #endif |
|
10489 ) |
|
10490 { |
|
10491 jstring res = NULL; |
|
10492 SWT_TRY |
|
10493 { |
|
10494 SWT_LOG_JNI_CALL(); |
|
10495 #ifndef QT_NO_WEBKIT |
|
10496 HANDLE_TO_POINTER( QWebView*, browser, aHandle ); |
|
10497 res = swtApp->jniUtils().QStringToJavaString( aJniEnv, browser->url().toString() ); |
|
10498 #endif |
|
10499 } |
|
10500 SWT_CATCH |
|
10501 return res; |
|
10502 } |
|
10503 |
|
10504 // |
|
10505 // Special purpose global functions exported by Qt |
|
10506 // |
|
10507 |
|
10508 JNIEXPORT void JNICALL OS_NATIVE( qt_1x11_1wait_1for_1window_1manager ) |
|
10509 (JNIEnv* aJniEnv , jclass, jint |
|
10510 #ifdef Q_WS_X11 |
|
10511 aHandle |
|
10512 #endif |
|
10513 ) |
|
10514 { |
|
10515 SWT_TRY |
|
10516 { |
|
10517 SWT_LOG_JNI_CALL(); |
|
10518 #ifdef Q_WS_X11 |
|
10519 SWT_LOG_DATA_1("handle=%d", aHandle); |
|
10520 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
10521 qt_x11_wait_for_window_manager( widget ); |
|
10522 #endif |
|
10523 } |
|
10524 SWT_CATCH |
|
10525 } |
|
10526 |
|
10527 // |
|
10528 // QSystemTrayIcon |
|
10529 // |
|
10530 |
|
10531 JNIEXPORT jboolean JNICALL OS_NATIVE( QSystemTrayIcon_1isSystemTrayAvailable ) |
|
10532 (JNIEnv* aJniEnv , jclass) |
|
10533 { |
|
10534 bool result = false; |
|
10535 SWT_TRY |
|
10536 { |
|
10537 SWT_LOG_JNI_CALL(); |
|
10538 #ifndef QT_NO_SYSTEMTRAYICON |
|
10539 SWT_LOG_DATA_1( "call QSystemTrayIcon::isSystemTrayAvailable %d", 0 ); |
|
10540 result = QSystemTrayIcon::isSystemTrayAvailable(); |
|
10541 #endif |
|
10542 } |
|
10543 SWT_CATCH |
|
10544 return ( result ? JNI_TRUE : JNI_FALSE ); |
|
10545 } |
|
10546 |
|
10547 JNIEXPORT jint JNICALL OS_NATIVE( QSystemTrayIcon_1new ) |
|
10548 (JNIEnv* aJniEnv , jclass, jint |
|
10549 #ifndef QT_NO_SYSTEMTRAYICON |
|
10550 aParent |
|
10551 #endif |
|
10552 ) |
|
10553 { |
|
10554 jint retVal = 0; |
|
10555 SWT_TRY |
|
10556 { |
|
10557 SWT_LOG_JNI_CALL(); |
|
10558 #ifndef QT_NO_SYSTEMTRAYICON |
|
10559 HANDLE_TO_POINTER( QObject*, parent, aParent ); |
|
10560 QSystemTrayIcon* tray = NULL; |
|
10561 tray = new QSystemTrayIcon( parent ); |
|
10562 retVal = POINTER_TO_HANDLE( tray ); |
|
10563 #endif |
|
10564 } |
|
10565 SWT_CATCH |
|
10566 return retVal; |
|
10567 } |
|
10568 |
|
10569 JNIEXPORT void JNICALL OS_NATIVE( QSystemTrayIcon_1setIcon ) |
|
10570 (JNIEnv* aJniEnv , jclass, jint |
|
10571 #ifndef QT_NO_SYSTEMTRAYICON |
|
10572 aHandle |
|
10573 #endif |
|
10574 , jint |
|
10575 #ifndef QT_NO_SYSTEMTRAYICON |
|
10576 aIconHandle |
|
10577 #endif |
|
10578 ) |
|
10579 { |
|
10580 SWT_TRY |
|
10581 { |
|
10582 SWT_LOG_JNI_CALL(); |
|
10583 #ifndef QT_NO_SYSTEMTRAYICON |
|
10584 SWT_LOG_DATA_2("handle=%x, aIconHandle=%x", aHandle, aIconHandle ); |
|
10585 HANDLE_TO_POINTER( QSystemTrayIcon*, tray, aHandle ); |
|
10586 QIcon* icon = reinterpret_cast<QIcon*>(aIconHandle); |
|
10587 tray->setIcon( *icon ); |
|
10588 #endif |
|
10589 } |
|
10590 SWT_CATCH |
|
10591 } |
|
10592 |
|
10593 JNIEXPORT jboolean JNICALL OS_NATIVE(QSystemTrayIcon_1isVisible) |
|
10594 (JNIEnv* aJniEnv , jclass, jint |
|
10595 #ifndef QT_NO_SYSTEMTRAYICON |
|
10596 aHandle |
|
10597 #endif |
|
10598 ) |
|
10599 { |
|
10600 bool visible = false; |
|
10601 SWT_TRY |
|
10602 { |
|
10603 SWT_LOG_JNI_CALL(); |
|
10604 #ifndef QT_NO_SYSTEMTRAYICON |
|
10605 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10606 HANDLE_TO_POINTER( QSystemTrayIcon*, tray, aHandle ); |
|
10607 visible = tray->isVisible(); |
|
10608 #endif |
|
10609 } |
|
10610 SWT_CATCH |
|
10611 return ( visible ? JNI_TRUE : JNI_FALSE ); |
|
10612 } |
|
10613 |
|
10614 JNIEXPORT void JNICALL OS_NATIVE(QSystemTrayIcon_1setVisible) |
|
10615 (JNIEnv* aJniEnv , jclass, jint |
|
10616 #ifndef QT_NO_SYSTEMTRAYICON |
|
10617 aHandle |
|
10618 #endif |
|
10619 , jboolean |
|
10620 #ifndef QT_NO_SYSTEMTRAYICON |
|
10621 aVisible |
|
10622 #endif |
|
10623 ) |
|
10624 { |
|
10625 SWT_TRY |
|
10626 { |
|
10627 SWT_LOG_JNI_CALL(); |
|
10628 #ifndef QT_NO_SYSTEMTRAYICON |
|
10629 SWT_LOG_DATA_2("handle=%x visible=%d", aHandle, aVisible); |
|
10630 HANDLE_TO_POINTER( QSystemTrayIcon*, tray, aHandle ); |
|
10631 tray->setVisible( aVisible == JNI_TRUE ? true : false ); |
|
10632 #endif |
|
10633 } |
|
10634 SWT_CATCH |
|
10635 } |
|
10636 |
|
10637 JNIEXPORT void JNICALL OS_NATIVE (QSystemTrayIcon_1setToolTip) |
|
10638 (JNIEnv* aJniEnv , jclass, jint |
|
10639 #ifndef QT_NO_SYSTEMTRAYICON |
|
10640 aHandle |
|
10641 #endif |
|
10642 , jstring |
|
10643 #ifndef QT_NO_SYSTEMTRAYICON |
|
10644 aText |
|
10645 #endif |
|
10646 ) |
|
10647 { |
|
10648 SWT_TRY |
|
10649 { |
|
10650 SWT_LOG_JNI_CALL(); |
|
10651 #ifndef QT_NO_SYSTEMTRAYICON |
|
10652 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10653 HANDLE_TO_POINTER( QSystemTrayIcon*, tray, aHandle ); |
|
10654 tray->setToolTip( swtApp->jniUtils().JavaStringToQString( aJniEnv, aText ) ); |
|
10655 #endif |
|
10656 } |
|
10657 SWT_CATCH |
|
10658 } |
|
10659 // |
|
10660 // QFileDialog |
|
10661 // |
|
10662 |
|
10663 JNIEXPORT jobjectArray JNICALL OS_NATIVE (QFileDialog_1swt_1getOpenFileName) |
|
10664 ( JNIEnv* aJniEnv , jclass, jint aParent, jstring aTitle, jstring aDirectory, jstring aFilter, jstring aSelectedFilter, jstring aDialogID, jint aLayoutDirection ) |
|
10665 { |
|
10666 jobjectArray javaStringArray = NULL; |
|
10667 SWT_TRY |
|
10668 { |
|
10669 SWT_LOG_JNI_CALL(); |
|
10670 SWT_LOG_DATA_2( "parent=%x direction=%d ", aParent, aLayoutDirection ); |
|
10671 HANDLE_TO_POINTER(QWidget*, parent, aParent); |
|
10672 QFileDialog dialog( parent, |
|
10673 aTitle != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle) : QString(), |
|
10674 aDirectory != NULL ?swtApp->jniUtils().JavaStringToQString(aJniEnv, aDirectory) : QString(), |
|
10675 aFilter != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aFilter) : QString(0 ) ); |
|
10676 dialog.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID ) ); |
|
10677 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
10678 dialog.setFileMode(QFileDialog::ExistingFile); |
|
10679 dialog.setAcceptMode( static_cast<QFileDialog::AcceptMode>(QFileDialog::AcceptOpen) ); |
|
10680 if(aSelectedFilter != NULL) |
|
10681 { |
|
10682 dialog.selectFilter (swtApp->jniUtils().JavaStringToQString(aJniEnv, aSelectedFilter)); |
|
10683 } |
|
10684 AutoPopExecStack stackExec(&dialog); |
|
10685 int code = dialog.exec(); |
|
10686 if( code == QDialog::Accepted ) |
|
10687 { |
|
10688 QStringList stringList = dialog.selectedFiles(); |
|
10689 stringList.append( dialog.selectedFilter() ); |
|
10690 javaStringArray = swtApp->jniUtils().NewJavaStringArray(aJniEnv, stringList); |
|
10691 } |
|
10692 } |
|
10693 SWT_CATCH |
|
10694 return javaStringArray; |
|
10695 } |
|
10696 |
|
10697 JNIEXPORT jobjectArray JNICALL OS_NATIVE (QFileDialog_1swt_1getOpenFileNames) |
|
10698 ( JNIEnv* aJniEnv , jclass, jint aParent, jstring aTitle, jstring aDirectory, jstring aFilter, jstring aSelectedFilter, jstring aDialogID, jint aLayoutDirection ) |
|
10699 { |
|
10700 jobjectArray javaStringArray = NULL; |
|
10701 SWT_TRY |
|
10702 { |
|
10703 SWT_LOG_JNI_CALL(); |
|
10704 SWT_LOG_DATA_2( "parent=%x direction=%d ", aParent, aLayoutDirection ); |
|
10705 HANDLE_TO_POINTER(QWidget*, parent, aParent); |
|
10706 QFileDialog dialog( parent, |
|
10707 aTitle != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle) : QString(), |
|
10708 aDirectory != NULL ?swtApp->jniUtils().JavaStringToQString(aJniEnv, aDirectory) : QString(), |
|
10709 aFilter != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aFilter) : QString(0 ) ); |
|
10710 dialog.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID ) ); |
|
10711 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
10712 dialog.setFileMode(QFileDialog::ExistingFiles); |
|
10713 dialog.setAcceptMode( static_cast<QFileDialog::AcceptMode>(QFileDialog::AcceptOpen) ); |
|
10714 if(aSelectedFilter != NULL) |
|
10715 { |
|
10716 dialog.selectFilter (swtApp->jniUtils().JavaStringToQString(aJniEnv, aSelectedFilter)); |
|
10717 } |
|
10718 AutoPopExecStack stackExec(&dialog); |
|
10719 int code = dialog.exec(); |
|
10720 if( code == QDialog::Accepted ) |
|
10721 { |
|
10722 QStringList stringList = dialog.selectedFiles(); |
|
10723 stringList.append( dialog.selectedFilter() ); |
|
10724 javaStringArray = swtApp->jniUtils().NewJavaStringArray(aJniEnv, stringList); |
|
10725 } |
|
10726 } |
|
10727 SWT_CATCH |
|
10728 return javaStringArray; |
|
10729 } |
|
10730 |
|
10731 JNIEXPORT jobjectArray JNICALL OS_NATIVE (QFileDialog_1swt_1getSaveFileName) |
|
10732 ( JNIEnv* aJniEnv , jclass, jint aParent, jstring aTitle, jstring aDirectory, jstring aFilter, jstring aSelectedFilter, jstring aDialogID, jint aLayoutDirection ) |
|
10733 { |
|
10734 jobjectArray javaStringArray = NULL; |
|
10735 SWT_TRY |
|
10736 { |
|
10737 SWT_LOG_JNI_CALL(); |
|
10738 SWT_LOG_DATA_2( "parent=%x direction=%d ", aParent, aLayoutDirection ); |
|
10739 HANDLE_TO_POINTER(QWidget*, parent, aParent); |
|
10740 QFileDialog dialog( parent, |
|
10741 aTitle != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle) : QString(), |
|
10742 aDirectory != NULL ?swtApp->jniUtils().JavaStringToQString(aJniEnv, aDirectory) : QString(), |
|
10743 aFilter != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aFilter) : QString(0 ) ); |
|
10744 dialog.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID ) ); |
|
10745 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
10746 dialog.setAcceptMode( static_cast<QFileDialog::AcceptMode>(QFileDialog::AcceptSave) ); |
|
10747 dialog.setConfirmOverwrite ( false ); |
|
10748 dialog.setFileMode(QFileDialog::AnyFile); |
|
10749 if(aSelectedFilter != NULL) |
|
10750 { |
|
10751 dialog.selectFilter (swtApp->jniUtils().JavaStringToQString(aJniEnv, aSelectedFilter)); |
|
10752 } |
|
10753 AutoPopExecStack stackExec(&dialog); |
|
10754 int code = dialog.exec(); |
|
10755 if( code == QDialog::Accepted ) |
|
10756 { |
|
10757 QStringList stringList = dialog.selectedFiles(); |
|
10758 stringList.append( dialog.selectedFilter() ); |
|
10759 javaStringArray = swtApp->jniUtils().NewJavaStringArray(aJniEnv, stringList); |
|
10760 } |
|
10761 } |
|
10762 SWT_CATCH |
|
10763 return javaStringArray; |
|
10764 } |
|
10765 |
|
10766 JNIEXPORT jstring JNICALL OS_NATIVE (QFileDialog_1swt_1getOpenDirectoryName) |
|
10767 ( JNIEnv* aJniEnv , jclass, jint aParent, jstring aTitle, jstring aDirectory, jstring aDialogID, jint aLayoutDirection ) |
|
10768 { |
|
10769 jstring javaString = NULL; |
|
10770 SWT_TRY |
|
10771 { |
|
10772 SWT_LOG_JNI_CALL(); |
|
10773 SWT_LOG_DATA_2( "parent=%x direction=%d ", aParent, aLayoutDirection ); |
|
10774 HANDLE_TO_POINTER(QWidget*, parent, aParent); |
|
10775 QFileDialog dialog( parent, |
|
10776 aTitle != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle) : QString(), |
|
10777 aDirectory != NULL ? swtApp->jniUtils().JavaStringToQString(aJniEnv, aDirectory) : QString(), NULL ); |
|
10778 dialog.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID ) ); |
|
10779 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
10780 dialog.setFileMode( QFileDialog::DirectoryOnly ); |
|
10781 dialog.setAcceptMode( static_cast<QFileDialog::AcceptMode>(QFileDialog::AcceptOpen) ); |
|
10782 AutoPopExecStack stackExec(&dialog); |
|
10783 int code = dialog.exec(); |
|
10784 if( code == QDialog::Accepted ) |
|
10785 { |
|
10786 QStringList stringList = dialog.selectedFiles(); |
|
10787 if( stringList.count() > 0 ) |
|
10788 { |
|
10789 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, stringList.at(0)); |
|
10790 } |
|
10791 } |
|
10792 } |
|
10793 SWT_CATCH |
|
10794 return javaString; |
|
10795 } |
|
10796 |
|
10797 |
|
10798 JNIEXPORT void JNICALL OS_NATIVE (QDialog_1swt_1closeDialogs) |
|
10799 ( JNIEnv* aJniEnv , jclass, jint aObject, jstring aDialogID ) |
|
10800 { |
|
10801 SWT_TRY |
|
10802 { |
|
10803 SWT_LOG_JNI_CALL(); |
|
10804 SWT_LOG_DATA_1( "object=%x ", aObject ); |
|
10805 HANDLE_TO_POINTER(QObject*, object, aObject); |
|
10806 QObjectList children = object->children(); |
|
10807 if( aDialogID ) |
|
10808 { |
|
10809 // close the dialog which is identified by dialog ID |
|
10810 QString name = swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID ); |
|
10811 for(int i = 0; i < children.size(); ++i) |
|
10812 { |
|
10813 QDialog* dialog = qobject_cast<QDialog*>(children.at(i)); |
|
10814 if( dialog && dialog->objectName() == name ) |
|
10815 { |
|
10816 dialog->setParent(NULL); |
|
10817 dialog->reject(); |
|
10818 break; |
|
10819 } |
|
10820 } |
|
10821 } |
|
10822 else |
|
10823 { |
|
10824 // close all dialogs |
|
10825 for(int i = 0; i < children.size(); ++i) |
|
10826 { |
|
10827 QDialog* dialog = qobject_cast<QDialog*>(children.at(i)); |
|
10828 if( dialog ) |
|
10829 { |
|
10830 // next line can cause memory leak if the dialog was created in heap |
|
10831 dialog->setParent(NULL); |
|
10832 dialog->reject(); |
|
10833 } |
|
10834 } |
|
10835 } |
|
10836 } |
|
10837 SWT_CATCH |
|
10838 } |
|
10839 |
|
10840 // |
|
10841 // QDialog |
|
10842 // |
|
10843 JNIEXPORT jint JNICALL OS_NATIVE( QDialog_1new ) |
|
10844 (JNIEnv* aJniEnv, jclass, jint aParent, jint aFlags) |
|
10845 { |
|
10846 QDialog* dialog = NULL; |
|
10847 SWT_TRY |
|
10848 { |
|
10849 SWT_LOG_JNI_CALL(); |
|
10850 SWT_LOG_DATA_2("parent=%x flags=%x", aParent, aFlags); |
|
10851 |
|
10852 HANDLE_TO_POINTER( QWidget*, parent, aParent ); |
|
10853 dialog = new QDialog( parent, static_cast<Qt::WindowFlags>(aFlags) ); |
|
10854 } |
|
10855 SWT_CATCH |
|
10856 return POINTER_TO_HANDLE(dialog); |
|
10857 } |
|
10858 |
|
10859 // |
|
10860 // QTabWidget |
|
10861 // |
|
10862 JNIEXPORT jint JNICALL OS_NATIVE(QSwtTabWidget_1new) |
|
10863 (JNIEnv* aJniEnv , jclass) |
|
10864 { |
|
10865 QTabWidget* tabWidget = NULL; |
|
10866 SWT_TRY |
|
10867 { |
|
10868 SWT_LOG_JNI_CALL(); |
|
10869 tabWidget = new QSwtTabWidget(); |
|
10870 } |
|
10871 SWT_CATCH |
|
10872 return POINTER_TO_HANDLE(tabWidget); |
|
10873 } |
|
10874 |
|
10875 JNIEXPORT void JNICALL OS_NATIVE(QTabWidget_1addTab) |
|
10876 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aPageHandle, jint aIconHandle, jstring aLabel) |
|
10877 { |
|
10878 SWT_TRY |
|
10879 { |
|
10880 SWT_LOG_JNI_CALL(); |
|
10881 SWT_LOG_DATA_3("handle=%x, pageHandle=%x, iconHandle=%x", aHandle, aPageHandle, aIconHandle); |
|
10882 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle ); |
|
10883 HANDLE_TO_POINTER(QWidget*, page, aPageHandle); |
|
10884 QIcon* icon = reinterpret_cast<QIcon*>(aIconHandle); |
|
10885 tabWidget->addTab(page, *icon, swtApp->jniUtils().JavaStringToQString(aJniEnv, aLabel)); |
|
10886 } |
|
10887 SWT_CATCH |
|
10888 } |
|
10889 |
|
10890 JNIEXPORT jint JNICALL OS_NATIVE(QTabWidget_1count) |
|
10891 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
10892 { |
|
10893 jint count = 0; |
|
10894 SWT_TRY |
|
10895 { |
|
10896 SWT_LOG_JNI_CALL(); |
|
10897 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10898 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle ); |
|
10899 count = static_cast<jint>(tabWidget->count()); |
|
10900 } |
|
10901 SWT_CATCH |
|
10902 return count; |
|
10903 } |
|
10904 |
|
10905 JNIEXPORT jint JNICALL OS_NATIVE(QTabWidget_1currentIndex) |
|
10906 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
10907 { |
|
10908 jint index = 0; |
|
10909 SWT_TRY |
|
10910 { |
|
10911 SWT_LOG_JNI_CALL(); |
|
10912 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
10913 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle ); |
|
10914 index = static_cast<jint>(tabWidget->currentIndex()); |
|
10915 } |
|
10916 SWT_CATCH |
|
10917 return index; |
|
10918 } |
|
10919 |
|
10920 JNIEXPORT void JNICALL OS_NATIVE(QTabWidget_1removeTab) |
|
10921 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
10922 { |
|
10923 SWT_TRY |
|
10924 { |
|
10925 SWT_LOG_JNI_CALL(); |
|
10926 SWT_LOG_DATA_2("handle=%x, index=%d", aHandle, aIndex); |
|
10927 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle); |
|
10928 tabWidget->removeTab(static_cast<int>(aIndex)); |
|
10929 } |
|
10930 SWT_CATCH |
|
10931 } |
|
10932 |
|
10933 JNIEXPORT void JNICALL OS_NATIVE(QTabWidget_1setCurrentIndex) |
|
10934 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
10935 { |
|
10936 SWT_TRY |
|
10937 { |
|
10938 SWT_LOG_JNI_CALL(); |
|
10939 SWT_LOG_DATA_2("handle=%x, index=%d", aHandle, aIndex); |
|
10940 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle); |
|
10941 tabWidget->setCurrentIndex(static_cast<int>(aIndex)); |
|
10942 } |
|
10943 SWT_CATCH |
|
10944 } |
|
10945 |
|
10946 JNIEXPORT void JNICALL OS_NATIVE(QTabWidget_1setTabIcon) |
|
10947 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jint aIconHandle) |
|
10948 { |
|
10949 SWT_TRY |
|
10950 { |
|
10951 SWT_LOG_JNI_CALL(); |
|
10952 SWT_LOG_DATA_3("handle=%x, index=%d, iconHandle=%x", aHandle, aIndex, aIconHandle); |
|
10953 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle); |
|
10954 tabWidget->setTabIcon(static_cast<int>(aIndex), *(reinterpret_cast<QIcon*>(aIconHandle))); |
|
10955 } |
|
10956 SWT_CATCH |
|
10957 } |
|
10958 |
|
10959 JNIEXPORT void JNICALL OS_NATIVE(QTabWidget_1setTabText) |
|
10960 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex, jstring aText) |
|
10961 { |
|
10962 SWT_TRY |
|
10963 { |
|
10964 SWT_LOG_JNI_CALL(); |
|
10965 SWT_LOG_DATA_2("handle=%x, index=%d", aHandle, aIndex); |
|
10966 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle); |
|
10967 tabWidget->setTabText(static_cast<int>(aIndex), swtApp->jniUtils().JavaStringToQString(aJniEnv, aText)); |
|
10968 } |
|
10969 SWT_CATCH |
|
10970 } |
|
10971 |
|
10972 JNIEXPORT jstring JNICALL OS_NATIVE(QTabWidget_1tabText) |
|
10973 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
10974 { |
|
10975 jstring javaString = NULL; |
|
10976 SWT_TRY |
|
10977 { |
|
10978 SWT_LOG_JNI_CALL(); |
|
10979 SWT_LOG_DATA_2("handle=%x, index=%d", aHandle, aIndex); |
|
10980 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle); |
|
10981 javaString = swtApp->jniUtils().QStringToJavaString(aJniEnv, tabWidget->tabText(static_cast<int>(aIndex))); |
|
10982 } |
|
10983 SWT_CATCH |
|
10984 return javaString; |
|
10985 } |
|
10986 |
|
10987 JNIEXPORT jint JNICALL OS_NATIVE(QTabWidget_1widget) |
|
10988 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aIndex) |
|
10989 { |
|
10990 jint handle = 0; |
|
10991 SWT_TRY |
|
10992 { |
|
10993 SWT_LOG_JNI_CALL(); |
|
10994 SWT_LOG_DATA_2("handle=%x, index=%d", aHandle, aIndex); |
|
10995 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle ); |
|
10996 handle = POINTER_TO_HANDLE(tabWidget->widget(static_cast<int>(aIndex))); |
|
10997 } |
|
10998 SWT_CATCH |
|
10999 return handle; |
|
11000 } |
|
11001 |
|
11002 JNIEXPORT jint JNICALL OS_NATIVE(QTabWidget_1swt_1stackedWidgetHandle) |
|
11003 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
11004 { |
|
11005 jint handle = 0; |
|
11006 SWT_TRY |
|
11007 { |
|
11008 SWT_LOG_JNI_CALL(); |
|
11009 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11010 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle ); |
|
11011 QObjectList children = tabWidget->children(); |
|
11012 int childCount = children.size(); |
|
11013 for(int i = 0; i < childCount; ++i) |
|
11014 { |
|
11015 if (qobject_cast<QStackedWidget*>(children.at(i))) |
|
11016 { |
|
11017 handle = POINTER_TO_HANDLE(children.at(i)); |
|
11018 break; |
|
11019 } |
|
11020 } |
|
11021 } |
|
11022 SWT_CATCH |
|
11023 return handle; |
|
11024 } |
|
11025 |
|
11026 JNIEXPORT jobject JNICALL OS_NATIVE(QSwtTabWidget_1stackedWidgetSize) |
|
11027 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
11028 { |
|
11029 jobject javaPoint = NULL; |
|
11030 SWT_TRY |
|
11031 { |
|
11032 SWT_LOG_JNI_CALL(); |
|
11033 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11034 HANDLE_TO_POINTER(QSwtTabWidget*, tabWidget, aHandle); |
|
11035 javaPoint = swtApp->jniUtils().NewJavaPoint(aJniEnv, tabWidget->stackedWidgetSize()); |
|
11036 } |
|
11037 SWT_CATCH |
|
11038 return javaPoint; |
|
11039 } |
|
11040 |
|
11041 JNIEXPORT jint JNICALL OS_NATIVE(QTabWidget_1tabBar) |
|
11042 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
11043 { |
|
11044 jint handle = 0; |
|
11045 SWT_TRY |
|
11046 { |
|
11047 SWT_LOG_JNI_CALL(); |
|
11048 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11049 HANDLE_TO_POINTER(QTabWidget*, tabWidget, aHandle ); |
|
11050 QObjectList children = tabWidget->children(); |
|
11051 int childCount = children.size(); |
|
11052 for(int i = 0; i < childCount; ++i) |
|
11053 { |
|
11054 if (qobject_cast<QTabBar*>(children.at(i))) |
|
11055 { |
|
11056 handle = POINTER_TO_HANDLE(children.at(i)); |
|
11057 break; |
|
11058 } |
|
11059 } |
|
11060 } |
|
11061 SWT_CATCH |
|
11062 return handle; |
|
11063 } |
|
11064 |
|
11065 |
|
11066 // |
|
11067 // QClipboard |
|
11068 // |
|
11069 JNIEXPORT void JNICALL OS_NATIVE( QClipboard_1clear ) |
|
11070 ( JNIEnv* aJniEnv , jclass ) |
|
11071 { |
|
11072 #ifndef QT_NO_CLIPBOARD |
|
11073 SWT_TRY |
|
11074 { |
|
11075 SWT_LOG_JNI_CALL(); |
|
11076 QApplication::clipboard()->clear(); |
|
11077 } |
|
11078 SWT_CATCH |
|
11079 #endif |
|
11080 } |
|
11081 |
|
11082 JNIEXPORT jbyteArray JNICALL OS_NATIVE( QClipboard_1mimeData ) |
|
11083 ( JNIEnv* aJniEnv , jclass, jstring aMimeType) |
|
11084 { |
|
11085 jbyteArray res = NULL; |
|
11086 #ifndef QT_NO_CLIPBOARD |
|
11087 SWT_TRY |
|
11088 { |
|
11089 SWT_LOG_JNI_CALL(); |
|
11090 const QMimeData* mimeData = QApplication::clipboard()->mimeData(); |
|
11091 QString dataType = swtApp->jniUtils().JavaStringToQString( aJniEnv, aMimeType ); |
|
11092 QByteArray byteArr = mimeData->data( dataType ); |
|
11093 SWT_LOG_DATA_2("Getting %d bytes, type %s", byteArr.count(), dataType.toLatin1().data()); |
|
11094 res = swtApp->jniUtils().NewJavaByteArray( aJniEnv, byteArr ); |
|
11095 } |
|
11096 SWT_CATCH |
|
11097 #endif |
|
11098 return res; |
|
11099 } |
|
11100 |
|
11101 JNIEXPORT void JNICALL OS_NATIVE( QClipboard_1setMimeData ) |
|
11102 ( JNIEnv* aJniEnv , jclass, jstring aMimeType, jbyteArray aByteArray ) |
|
11103 { |
|
11104 #ifndef QT_NO_CLIPBOARD |
|
11105 SWT_TRY |
|
11106 { |
|
11107 SWT_LOG_JNI_CALL(); |
|
11108 QByteArray byteArr = swtApp->jniUtils().JavaByteArrayToQByteArray( aJniEnv, aByteArray ); |
|
11109 QString dataType = swtApp->jniUtils().JavaStringToQString( aJniEnv, aMimeType ); |
|
11110 QMimeData* data = new QMimeData(); |
|
11111 data->setData( dataType, byteArr ); |
|
11112 SWT_LOG_DATA_2("Setting %d bytes, type %s", byteArr.count(), dataType.toLatin1().data()); |
|
11113 QApplication::clipboard()->setMimeData( data ); |
|
11114 } |
|
11115 SWT_CATCH |
|
11116 #endif |
|
11117 } |
|
11118 |
|
11119 JNIEXPORT jobjectArray JNICALL OS_NATIVE( QClipboard_1swt_1formats ) |
|
11120 ( JNIEnv* aJniEnv , jclass ) |
|
11121 { |
|
11122 jobjectArray res = NULL; |
|
11123 #ifndef QT_NO_CLIPBOARD |
|
11124 SWT_TRY |
|
11125 { |
|
11126 SWT_LOG_JNI_CALL(); |
|
11127 QClipboard* clip = QApplication::clipboard(); |
|
11128 const QMimeData* mimeData = clip->mimeData(); |
|
11129 res = swtApp->jniUtils().NewJavaStringArray( aJniEnv, mimeData->formats() ); |
|
11130 } |
|
11131 SWT_CATCH |
|
11132 #endif |
|
11133 return res; |
|
11134 } |
|
11135 |
|
11136 JNIEXPORT jboolean JNICALL OS_NATIVE( QClipboard_1swt_1isEmptyText ) |
|
11137 ( JNIEnv* aJniEnv , jclass ) |
|
11138 { |
|
11139 jboolean res = JNI_TRUE; |
|
11140 #ifndef QT_NO_CLIPBOARD |
|
11141 SWT_TRY |
|
11142 { |
|
11143 SWT_LOG_JNI_CALL(); |
|
11144 const QMimeData* mimeData = QApplication::clipboard()->mimeData(); |
|
11145 if(!mimeData->hasText() || !mimeData->text().isEmpty()) |
|
11146 { |
|
11147 res = JNI_FALSE; |
|
11148 } |
|
11149 } |
|
11150 SWT_CATCH |
|
11151 #endif |
|
11152 return res; |
|
11153 } |
|
11154 |
|
11155 JNIEXPORT jstring JNICALL OS_NATIVE( QClipboard_1text ) |
|
11156 ( JNIEnv* aJniEnv , jclass) |
|
11157 { |
|
11158 jstring res = NULL; |
|
11159 #ifndef QT_NO_CLIPBOARD |
|
11160 SWT_TRY |
|
11161 { |
|
11162 SWT_LOG_JNI_CALL(); |
|
11163 QClipboard* clip = QApplication::clipboard(); |
|
11164 res = swtApp->jniUtils().QStringToJavaString( aJniEnv, clip->text() ); |
|
11165 } |
|
11166 SWT_CATCH |
|
11167 #endif |
|
11168 return res; |
|
11169 } |
|
11170 |
|
11171 // |
|
11172 // QFontDialog |
|
11173 // |
|
11174 JNIEXPORT jint JNICALL OS_NATIVE(QFontDialog_1swt_1getFont) |
|
11175 ( JNIEnv* aJniEnv , jclass, jint aParentHandle, jstring aTitle, |
|
11176 jstring aFamily, jint aPointSize, jint aWeight, jboolean aItalic, jstring aDialogID, jint aLayoutDirection) |
|
11177 { |
|
11178 QFont* font(NULL); |
|
11179 SWT_TRY |
|
11180 { |
|
11181 SWT_LOG_JNI_CALL(); |
|
11182 SWT_LOG_DATA_5("parent=%x, size=%d, weight=%d, italic=%d, layoutDirection=%d", aParentHandle, aPointSize, aWeight, aItalic, aLayoutDirection); |
|
11183 HANDLE_TO_POINTER(QWidget*, parent, aParentHandle ); |
|
11184 QFont initialFont; |
|
11185 if (static_cast<int>(aPointSize) > -1) |
|
11186 { |
|
11187 initialFont = QFont(swtApp->jniUtils().JavaStringToQString(aJniEnv, aFamily), |
|
11188 static_cast<int>(aPointSize), |
|
11189 static_cast<int>(aWeight), |
|
11190 aItalic == JNI_TRUE ? true : false); |
|
11191 } |
|
11192 |
|
11193 QFontDialog dialog( initialFont, parent ); |
|
11194 dialog.setObjectName( swtApp->jniUtils().JavaStringToQString(aJniEnv, aDialogID ) ); |
|
11195 dialog.setLayoutDirection( static_cast<Qt::LayoutDirection>(aLayoutDirection) ); |
|
11196 dialog.setWindowTitle(swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle)); |
|
11197 AutoPopExecStack stackExec(&dialog); |
|
11198 int code = dialog.exec(); |
|
11199 if( code == QDialog::Accepted ) |
|
11200 { |
|
11201 QFont selected = dialog.selectedFont(); |
|
11202 font = new QFont( selected ); |
|
11203 } |
|
11204 } |
|
11205 SWT_CATCH |
|
11206 return reinterpret_cast<jint>(font); |
|
11207 } |
|
11208 |
|
11209 |
|
11210 // |
|
11211 // QStyle |
|
11212 // |
|
11213 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1pixelMetric |
|
11214 (JNIEnv *aJniEnv, jclass, jint aId) |
|
11215 { |
|
11216 jint metric = -1; |
|
11217 SWT_TRY |
|
11218 { |
|
11219 SWT_LOG_JNI_CALL(); |
|
11220 SWT_LOG_DATA_1("id=%d", aId); |
|
11221 QStyle* style = QApplication::style(); |
|
11222 if (style) |
|
11223 { |
|
11224 metric = static_cast<jint>(style->pixelMetric(static_cast<QStyle::PixelMetric>(aId))); |
|
11225 } |
|
11226 } |
|
11227 SWT_CATCH |
|
11228 return metric; |
|
11229 } |
|
11230 |
|
11231 JNIEXPORT jint JNICALL OS_NATIVE(QStyle_1standardIcon) |
|
11232 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStandardIconId) |
|
11233 { |
|
11234 QIcon* icon = NULL; |
|
11235 SWT_TRY |
|
11236 { |
|
11237 SWT_LOG_JNI_CALL(); |
|
11238 SWT_LOG_DATA_2("handle=%x iconId=%d", aHandle, aStandardIconId); |
|
11239 HANDLE_TO_POINTER(QStyle*,style, aHandle); |
|
11240 icon = new QIcon(style->standardIcon(static_cast<QStyle::StandardPixmap>(aStandardIconId))); |
|
11241 } |
|
11242 SWT_CATCH |
|
11243 return reinterpret_cast<jint>(icon); |
|
11244 } |
|
11245 |
|
11246 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1dockWidgetTitleBarButtonMargin |
|
11247 (JNIEnv *, jclass) |
|
11248 { |
|
11249 return static_cast<jint>(QStyle::PM_DockWidgetTitleBarButtonMargin); |
|
11250 } |
|
11251 |
|
11252 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1mdiSubWindowMinimizedWidth |
|
11253 (JNIEnv *, jclass) |
|
11254 { |
|
11255 return static_cast<jint>(QStyle::PM_MdiSubWindowMinimizedWidth); |
|
11256 } |
|
11257 |
|
11258 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1layoutLeftMargin |
|
11259 (JNIEnv *, jclass) |
|
11260 { |
|
11261 return static_cast<jint>(QStyle::PM_LayoutLeftMargin); |
|
11262 } |
|
11263 |
|
11264 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1layoutTopMargin |
|
11265 (JNIEnv *, jclass) |
|
11266 { |
|
11267 return static_cast<jint>(QStyle::PM_LayoutTopMargin); |
|
11268 } |
|
11269 |
|
11270 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1layoutRightMargin |
|
11271 (JNIEnv *, jclass) |
|
11272 { |
|
11273 return static_cast<jint>(QStyle::PM_LayoutRightMargin); |
|
11274 } |
|
11275 |
|
11276 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1layoutBottomMargin |
|
11277 (JNIEnv *, jclass) |
|
11278 { |
|
11279 return static_cast<jint>(QStyle::PM_LayoutBottomMargin); |
|
11280 } |
|
11281 |
|
11282 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1layoutHorizontalSpacing |
|
11283 (JNIEnv *, jclass) |
|
11284 { |
|
11285 return static_cast<jint>(QStyle::PM_LayoutHorizontalSpacing); |
|
11286 } |
|
11287 |
|
11288 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1layoutVerticalSpacing |
|
11289 (JNIEnv *, jclass) |
|
11290 { |
|
11291 return static_cast<jint>(QStyle::PM_LayoutVerticalSpacing); |
|
11292 } |
|
11293 |
|
11294 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1dockWidgetTitleMargin |
|
11295 (JNIEnv *, jclass) |
|
11296 { |
|
11297 return static_cast<jint>(QStyle::PM_DockWidgetTitleMargin); |
|
11298 } |
|
11299 |
|
11300 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarFrameWidth |
|
11301 (JNIEnv *, jclass) |
|
11302 { |
|
11303 return static_cast<jint>(QStyle::PM_ToolBarFrameWidth); |
|
11304 } |
|
11305 |
|
11306 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarHandleExtent |
|
11307 (JNIEnv *, jclass) |
|
11308 { |
|
11309 return static_cast<jint>(QStyle::PM_ToolBarHandleExtent); |
|
11310 } |
|
11311 |
|
11312 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarItemMargin |
|
11313 (JNIEnv *, jclass) |
|
11314 { |
|
11315 return static_cast<jint>(QStyle::PM_ToolBarItemMargin); |
|
11316 } |
|
11317 |
|
11318 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarItemSpacing |
|
11319 (JNIEnv *, jclass) |
|
11320 { |
|
11321 return static_cast<jint>(QStyle::PM_ToolBarItemSpacing); |
|
11322 } |
|
11323 |
|
11324 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarSeparatorExtent |
|
11325 (JNIEnv *, jclass) |
|
11326 { |
|
11327 return static_cast<jint>(QStyle::PM_ToolBarSeparatorExtent); |
|
11328 } |
|
11329 |
|
11330 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarExtensionExtent |
|
11331 (JNIEnv *, jclass) |
|
11332 { |
|
11333 return static_cast<jint>(QStyle::PM_ToolBarExtensionExtent); |
|
11334 } |
|
11335 |
|
11336 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabBarScrollButtonWidth |
|
11337 (JNIEnv *, jclass) |
|
11338 { |
|
11339 return static_cast<jint>(QStyle::PM_TabBarScrollButtonWidth); |
|
11340 } |
|
11341 |
|
11342 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabBarTabShiftHorizontal |
|
11343 (JNIEnv *, jclass) |
|
11344 { |
|
11345 return static_cast<jint>(QStyle::PM_TabBarTabShiftHorizontal); |
|
11346 } |
|
11347 |
|
11348 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabBarTabShiftVertical |
|
11349 (JNIEnv *, jclass) |
|
11350 { |
|
11351 return static_cast<jint>(QStyle::PM_TabBarTabShiftVertical); |
|
11352 } |
|
11353 |
|
11354 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1headerMarkSize |
|
11355 (JNIEnv *, jclass) |
|
11356 { |
|
11357 return static_cast<jint>(QStyle::PM_HeaderMarkSize); |
|
11358 } |
|
11359 |
|
11360 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1headerGripMargin |
|
11361 (JNIEnv *, jclass) |
|
11362 { |
|
11363 return static_cast<jint>(QStyle::PM_HeaderGripMargin); |
|
11364 } |
|
11365 |
|
11366 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1headerMargin |
|
11367 (JNIEnv *, jclass) |
|
11368 { |
|
11369 return static_cast<jint>(QStyle::PM_HeaderMargin); |
|
11370 } |
|
11371 |
|
11372 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1SpinBoxSliderHeight |
|
11373 (JNIEnv *, jclass) |
|
11374 { |
|
11375 return static_cast<jint>(QStyle::PM_SpinBoxSliderHeight); |
|
11376 } |
|
11377 |
|
11378 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolBarIconSize |
|
11379 (JNIEnv *, jclass) |
|
11380 { |
|
11381 return static_cast<jint>(QStyle::PM_ToolBarIconSize); |
|
11382 } |
|
11383 |
|
11384 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1smallIconSize |
|
11385 (JNIEnv *, jclass) |
|
11386 { |
|
11387 return static_cast<jint>(QStyle::PM_SmallIconSize); |
|
11388 } |
|
11389 |
|
11390 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1largeIconSize |
|
11391 (JNIEnv *, jclass) |
|
11392 { |
|
11393 return static_cast<jint>(QStyle::PM_LargeIconSize); |
|
11394 } |
|
11395 |
|
11396 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1focusFrameHMargin |
|
11397 (JNIEnv *, jclass) |
|
11398 { |
|
11399 return static_cast<jint>(QStyle::PM_FocusFrameHMargin); |
|
11400 } |
|
11401 |
|
11402 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1focusFrameVMargin |
|
11403 (JNIEnv *, jclass) |
|
11404 { |
|
11405 return static_cast<jint>(QStyle::PM_FocusFrameVMargin); |
|
11406 } |
|
11407 |
|
11408 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1iconViewIconSize |
|
11409 (JNIEnv *, jclass) |
|
11410 { |
|
11411 return static_cast<jint>(QStyle::PM_IconViewIconSize); |
|
11412 } |
|
11413 |
|
11414 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1listViewIconSize |
|
11415 (JNIEnv *, jclass) |
|
11416 { |
|
11417 return static_cast<jint>(QStyle::PM_ListViewIconSize); |
|
11418 } |
|
11419 |
|
11420 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1toolTipLabelFrameWidth |
|
11421 (JNIEnv *, jclass) |
|
11422 { |
|
11423 return static_cast<jint>(QStyle::PM_ToolTipLabelFrameWidth); |
|
11424 } |
|
11425 |
|
11426 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1checkBoxLabelSpacing |
|
11427 (JNIEnv *, jclass) |
|
11428 { |
|
11429 return static_cast<jint>(QStyle::PM_CheckBoxLabelSpacing); |
|
11430 } |
|
11431 |
|
11432 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1radioButtonLabelSpacing |
|
11433 (JNIEnv *, jclass) |
|
11434 { |
|
11435 return static_cast<jint>(QStyle::PM_RadioButtonLabelSpacing); |
|
11436 } |
|
11437 |
|
11438 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabBarIconSize |
|
11439 (JNIEnv *, jclass) |
|
11440 { |
|
11441 return static_cast<jint>(QStyle::PM_TabBarIconSize); |
|
11442 } |
|
11443 |
|
11444 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1sizeGripSize |
|
11445 (JNIEnv *, jclass) |
|
11446 { |
|
11447 return static_cast<jint>(QStyle::PM_SizeGripSize); |
|
11448 } |
|
11449 |
|
11450 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1messageBoxIconSize |
|
11451 (JNIEnv *, jclass) |
|
11452 { |
|
11453 return static_cast<jint>(QStyle::PM_MessageBoxIconSize); |
|
11454 } |
|
11455 |
|
11456 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1buttonIconSize |
|
11457 (JNIEnv *, jclass) |
|
11458 { |
|
11459 return static_cast<jint>(QStyle::PM_ButtonIconSize); |
|
11460 } |
|
11461 |
|
11462 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1textCursorWidth |
|
11463 (JNIEnv *, jclass) |
|
11464 { |
|
11465 return static_cast<jint>(QStyle::PM_TextCursorWidth); |
|
11466 } |
|
11467 |
|
11468 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabBarScrollButtonOverlap |
|
11469 (JNIEnv *, jclass) |
|
11470 { |
|
11471 return static_cast<jint>(QStyle::PM_TabBar_ScrollButtonOverlap); |
|
11472 } |
|
11473 |
|
11474 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabCloseIndicatorWidth |
|
11475 (JNIEnv *, jclass) |
|
11476 { |
|
11477 return static_cast<jint>(QStyle::PM_TabCloseIndicatorWidth); |
|
11478 } |
|
11479 |
|
11480 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QStyle_1swt_1pm_1tabCloseIndicatorHeight |
|
11481 (JNIEnv *, jclass) |
|
11482 { |
|
11483 return static_cast<jint>(QStyle::PM_TabCloseIndicatorHeight); |
|
11484 } |
|
11485 |
|
11486 // |
|
11487 // QLocale |
|
11488 // |
|
11489 |
|
11490 JNIEXPORT jint JNICALL OS_NATIVE( QLocale_1system ) |
|
11491 (JNIEnv* aJniEnv, jclass) |
|
11492 { |
|
11493 QLocale* locale = NULL; |
|
11494 SWT_TRY |
|
11495 { |
|
11496 SWT_LOG_JNI_CALL(); |
|
11497 locale = new QLocale( QLocale::system() ); |
|
11498 } |
|
11499 SWT_CATCH |
|
11500 return reinterpret_cast<int>( locale ); |
|
11501 } |
|
11502 |
|
11503 JNIEXPORT jint JNICALL OS_NATIVE( QLocale_1language ) |
|
11504 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
11505 { |
|
11506 QLocale::Language language = QLocale::C; |
|
11507 SWT_TRY |
|
11508 { |
|
11509 SWT_LOG_JNI_CALL(); |
|
11510 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11511 QLocale* locale = reinterpret_cast<QLocale*>(aHandle); |
|
11512 language = locale->language(); |
|
11513 } |
|
11514 SWT_CATCH |
|
11515 return static_cast<int>( language ); |
|
11516 } |
|
11517 |
|
11518 JNIEXPORT void JNICALL OS_NATIVE( QLocale_1delete ) |
|
11519 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
11520 { |
|
11521 SWT_TRY |
|
11522 { |
|
11523 SWT_LOG_JNI_CALL(); |
|
11524 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11525 QLocale* locale = reinterpret_cast<QLocale*>(aHandle); |
|
11526 delete locale; |
|
11527 } |
|
11528 SWT_CATCH |
|
11529 } |
|
11530 |
|
11531 JNIEXPORT jint JNICALL OS_NATIVE( QImage_1swt_1paintDevice ) |
|
11532 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
11533 { |
|
11534 QPaintDevice* result = NULL; |
|
11535 SWT_TRY |
|
11536 { |
|
11537 SWT_LOG_JNI_CALL(); |
|
11538 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11539 result = static_cast<QPaintDevice*>( reinterpret_cast<QImage*>( static_cast<int>( aHandle ) ) ); |
|
11540 } |
|
11541 SWT_CATCH |
|
11542 return reinterpret_cast<jint>( result ); |
|
11543 } |
|
11544 // |
|
11545 // QChar |
|
11546 // |
|
11547 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_OS_QChar_1direction |
|
11548 (JNIEnv *aJniEnv, jclass, jchar aChar) |
|
11549 { |
|
11550 int result=-1; |
|
11551 SWT_TRY |
|
11552 { |
|
11553 SWT_LOG_JNI_CALL(); |
|
11554 result = QChar::direction(aChar); |
|
11555 } |
|
11556 SWT_CATCH |
|
11557 return result; |
|
11558 } |
|
11559 |
|
11560 // |
|
11561 // SwtFontCache |
|
11562 // |
|
11563 |
|
11564 JNIEXPORT jint JNICALL OS_NATIVE( SwtFontCache_1cache ) |
|
11565 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
11566 { |
|
11567 QFont* result = NULL; |
|
11568 SWT_TRY |
|
11569 { |
|
11570 SWT_LOG_JNI_CALL(); |
|
11571 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11572 QFont* font = reinterpret_cast<QFont*> ( aHandle ); |
|
11573 result = swtApp->fontCache().cache( font ); |
|
11574 } |
|
11575 SWT_CATCH |
|
11576 return reinterpret_cast<jint>( result ); |
|
11577 } |
|
11578 |
|
11579 JNIEXPORT jboolean JNICALL OS_NATIVE( SwtFontCache_1isCached ) |
|
11580 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
11581 { |
|
11582 bool result = false; |
|
11583 SWT_TRY |
|
11584 { |
|
11585 SWT_LOG_JNI_CALL(); |
|
11586 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11587 QFont* font = reinterpret_cast<QFont*> ( aHandle ); |
|
11588 result = swtApp->fontCache().isCached( font ); |
|
11589 } |
|
11590 SWT_CATCH |
|
11591 return result ? JNI_TRUE : JNI_FALSE; |
|
11592 } |
|
11593 |
|
11594 |
|
11595 // |
|
11596 // QInputContextFactory |
|
11597 // |
|
11598 |
|
11599 JNIEXPORT jint JNICALL OS_NATIVE( QInputContextFactory_1create ) |
|
11600 (JNIEnv* aJniEnv, jclass, jstring aKey, jint aParent) |
|
11601 { |
|
11602 QInputContext* inputContext = NULL; |
|
11603 SWT_TRY |
|
11604 { |
|
11605 SWT_LOG_JNI_CALL(); |
|
11606 SWT_LOG_DATA_1("parent=%x", aParent); |
|
11607 QObject* parent = reinterpret_cast<QObject*>(aParent); |
|
11608 inputContext = QInputContextFactory::create(swtApp->jniUtils().JavaStringToQString(aJniEnv, aKey), parent); |
|
11609 } |
|
11610 SWT_CATCH |
|
11611 return reinterpret_cast<jint>(inputContext); |
|
11612 } |
|
11613 |
|
11614 |
|
11615 JNIEXPORT jstring JNICALL OS_NATIVE( QInputContextFactory_1swt_1key ) |
|
11616 (JNIEnv* aJniEnv, jclass, jstring aLanguage) |
|
11617 { |
|
11618 jstring strKey = NULL; |
|
11619 SWT_TRY |
|
11620 { |
|
11621 SWT_LOG_JNI_CALL(); |
|
11622 QStringList keys = QInputContextFactory::keys(); |
|
11623 QStringList languages; |
|
11624 QString TargetedLanguage = swtApp->jniUtils().JavaStringToQString(aJniEnv, aLanguage); |
|
11625 for (int i = 0; i < keys.count(); i++) |
|
11626 { |
|
11627 const QString& key = keys.at(i); |
|
11628 languages = QInputContextFactory::languages(key); |
|
11629 for (int j = 0; j < languages.count(); j++) |
|
11630 { |
|
11631 const QString& language = languages.at(j); |
|
11632 if (TargetedLanguage == language |
|
11633 || language.contains(TargetedLanguage) |
|
11634 || TargetedLanguage.contains(language)) |
|
11635 { |
|
11636 strKey = swtApp->jniUtils().QStringToJavaString(aJniEnv, key); |
|
11637 break; |
|
11638 } |
|
11639 } |
|
11640 if (strKey != NULL) |
|
11641 break; |
|
11642 } |
|
11643 } |
|
11644 SWT_CATCH |
|
11645 return strKey; |
|
11646 } |
|
11647 |
|
11648 // |
|
11649 // SwtApplication |
|
11650 // |
|
11651 |
|
11652 JNIEXPORT jint JNICALL OS_NATIVE( SwtApplication_1javaCallbackCount ) |
|
11653 (JNIEnv* aJniEnv, jclass) |
|
11654 { |
|
11655 jint result = 0; |
|
11656 SWT_TRY |
|
11657 { |
|
11658 SWT_LOG_JNI_CALL(); |
|
11659 result = static_cast<jint>(swtApp->jniUtils().javaCallbackCount()); |
|
11660 } |
|
11661 SWT_CATCH |
|
11662 return result; |
|
11663 } |
|
11664 |
|
11665 JNIEXPORT void JNICALL OS_NATIVE( SwtApplication_1postDeferredEvents ) |
|
11666 (JNIEnv* aJniEnv, jclass) |
|
11667 { |
|
11668 SWT_TRY |
|
11669 { |
|
11670 SWT_LOG_JNI_CALL(); |
|
11671 swtApp->postDeferredEvents(); |
|
11672 } |
|
11673 SWT_CATCH |
|
11674 } |
|
11675 |
|
11676 |
|
11677 |
|
11678 |
|
11679 |
|
11680 // |
|
11681 // XQServiceRequest |
|
11682 // |
|
11683 |
|
11684 JNIEXPORT jint JNICALL OS_NATIVE( XQServiceRequest_1new ) |
|
11685 #ifdef __SYMBIAN32__ |
|
11686 (JNIEnv* aJniEnv, jclass, jstring aService, jstring aOperation, jboolean aSynchronous) |
|
11687 #else |
|
11688 (JNIEnv* aJniEnv, jclass, jstring, jstring, jboolean) |
|
11689 #endif |
|
11690 { |
|
11691 #ifdef __SYMBIAN32__ |
|
11692 XQServiceRequest* request = NULL; |
|
11693 SWT_TRY |
|
11694 { |
|
11695 SWT_LOG_JNI_CALL(); |
|
11696 request = new XQServiceRequest(swtApp->jniUtils().JavaStringToQString(aJniEnv, aService), swtApp->jniUtils().JavaStringToQString(aJniEnv, aOperation), aSynchronous == JNI_TRUE ? true : false); |
|
11697 } |
|
11698 SWT_CATCH |
|
11699 return reinterpret_cast<jint>(request); |
|
11700 #else |
|
11701 return NULL; |
|
11702 #endif |
|
11703 } |
|
11704 |
|
11705 |
|
11706 |
|
11707 JNIEXPORT void JNICALL OS_NATIVE( XQServiceRequest_1swt_1setArgumentsForFetchEmail ) |
|
11708 #ifdef __SYMBIAN32__ |
|
11709 (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aTitle, jstring aAction, jstring aFilter) |
|
11710 #else |
|
11711 (JNIEnv* aJniEnv, jclass, jint, jstring, jstring, jstring) |
|
11712 #endif |
|
11713 { |
|
11714 #ifdef __SYMBIAN32__ |
|
11715 SWT_TRY |
|
11716 { |
|
11717 SWT_LOG_JNI_CALL(); |
|
11718 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
11719 XQServiceRequest* request = reinterpret_cast<XQServiceRequest*>(aHandle); |
|
11720 *request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aTitle); |
|
11721 *request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aAction); |
|
11722 *request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aFilter); |
|
11723 } |
|
11724 SWT_CATCH |
|
11725 #endif |
|
11726 } |
|
11727 |
|
11728 |
|
11729 JNIEXPORT void JNICALL OS_NATIVE( XQServiceRequest_1swt_1setArgumentsForDial ) |
|
11730 #ifdef __SYMBIAN32__ |
|
11731 (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aNumber, jboolean aAsyncAnswer) |
|
11732 #else |
|
11733 (JNIEnv* aJniEnv, jclass, jint, jstring, jboolean) |
|
11734 #endif |
|
11735 { |
|
11736 #ifdef __SYMBIAN32__ |
|
11737 SWT_TRY |
|
11738 { |
|
11739 SWT_LOG_JNI_CALL(); |
|
11740 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
11741 XQServiceRequest* request = reinterpret_cast<XQServiceRequest*>(aHandle); |
|
11742 *request << swtApp->jniUtils().JavaStringToQString(aJniEnv, aNumber); |
|
11743 *request << (aAsyncAnswer == JNI_TRUE ? true : false); |
|
11744 } |
|
11745 SWT_CATCH |
|
11746 #endif |
|
11747 } |
|
11748 |
|
11749 |
|
11750 JNIEXPORT jboolean JNICALL OS_NATIVE( XQServiceRequest_1send ) |
|
11751 #ifdef __SYMBIAN32__ |
|
11752 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
11753 #else |
|
11754 (JNIEnv* aJniEnv, jclass, jint) |
|
11755 #endif |
|
11756 { |
|
11757 #ifdef __SYMBIAN32__ |
|
11758 bool result = false; |
|
11759 XQServiceRequest* client = NULL; |
|
11760 SWT_TRY |
|
11761 { |
|
11762 SWT_LOG_JNI_CALL(); |
|
11763 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
11764 XQServiceRequest* client = reinterpret_cast<XQServiceRequest*>(aHandle); |
|
11765 QVariant retValue; |
|
11766 result = client->send(retValue); |
|
11767 } |
|
11768 SWT_CATCH |
|
11769 return result ? JNI_TRUE : JNI_FALSE; |
|
11770 #else |
|
11771 return JNI_FALSE; |
|
11772 #endif |
|
11773 } |
|
11774 |
|
11775 |
|
11776 // |
|
11777 // CntServicesContactList |
|
11778 // |
|
11779 |
|
11780 JNIEXPORT jobjectArray JNICALL OS_NATIVE( CntServicesContactList_1swt_1contacts ) |
|
11781 #ifdef __SYMBIAN32__ |
|
11782 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
11783 #else |
|
11784 (JNIEnv* aJniEnv, jclass, jint) |
|
11785 #endif |
|
11786 { |
|
11787 #ifdef __SYMBIAN32__ |
|
11788 jobjectArray javaStringArray = NULL; |
|
11789 SWT_TRY |
|
11790 { |
|
11791 SWT_LOG_JNI_CALL(); |
|
11792 SWT_LOG_DATA_1( "handle=%x", aHandle ); |
|
11793 QVariant* variant = reinterpret_cast<QVariant*>(aHandle); |
|
11794 CntServicesContactList contacts = qVariantValue<CntServicesContactList>(*variant); |
|
11795 QStringList list; |
|
11796 for(int i = 0; i < contacts.count(); i++) |
|
11797 { |
|
11798 list.append(contacts.at(i).mDisplayName); |
|
11799 list.append(contacts.at(i).mPhoneNumber); |
|
11800 list.append(contacts.at(i).mEmailAddress); |
|
11801 |
|
11802 } |
|
11803 if(list.size() > 0) |
|
11804 { |
|
11805 javaStringArray = swtApp->jniUtils().NewJavaStringArray(aJniEnv, list); |
|
11806 } |
|
11807 } |
|
11808 SWT_CATCH |
|
11809 return javaStringArray; |
|
11810 #else |
|
11811 return NULL; |
|
11812 #endif |
|
11813 } |
|
11814 |
|
11815 |
|
11816 // |
|
11817 // Other |
|
11818 // |
|
11819 |
|
11820 JNIEXPORT jint JNICALL OS_NATIVE(EventHandler_1new) |
|
11821 ( JNIEnv* aJniEnv, jclass) |
|
11822 { |
|
11823 EventCallback* cb = NULL; |
|
11824 SWT_TRY |
|
11825 { |
|
11826 SWT_LOG_JNI_CALL(); |
|
11827 |
|
11828 // Event handler is owned by the Java peer (Display instance) |
|
11829 cb = new EventCallback(); |
|
11830 } |
|
11831 SWT_CATCH |
|
11832 return POINTER_TO_HANDLE( cb ); |
|
11833 } |
|
11834 |
|
11835 JNIEXPORT void JNICALL OS_NATIVE(EventHandler_1destroy) |
|
11836 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
11837 { |
|
11838 SWT_TRY |
|
11839 { |
|
11840 SWT_LOG_JNI_CALL(); |
|
11841 SWT_LOG_DATA_1("handle=%x", aHandle); |
|
11842 |
|
11843 HANDLE_TO_POINTER( EventCallback*, cb, aHandle ); |
|
11844 cb->Destroy(); |
|
11845 } |
|
11846 SWT_CATCH |
|
11847 } |
|
11848 |
|
11849 JNIEXPORT jint JNICALL OS_NATIVE(SignalHandler_1new) |
|
11850 (JNIEnv* aJniEnv, jclass, jint aWidget, jobject aPeer, jint aSignalId ) |
|
11851 { |
|
11852 SlotCallback* cb = NULL; |
|
11853 SWT_TRY |
|
11854 { |
|
11855 SWT_LOG_JNI_CALL(); |
|
11856 SWT_LOG_DATA_1("peer=%x", aPeer); |
|
11857 |
|
11858 HANDLE_TO_POINTER( QObject*, widget, aWidget ); |
|
11859 |
|
11860 // Widget takes ownership of the signal handler instance |
|
11861 cb = new SlotCallback( aJniEnv, aPeer, widget, aSignalId ); |
|
11862 } |
|
11863 SWT_CATCH |
|
11864 return POINTER_TO_HANDLE( cb ); |
|
11865 } |
|
11866 |
|
11867 JNIEXPORT jint JNICALL OS_NATIVE( JniUtils_1new ) |
|
11868 (JNIEnv* aJniEnv, jclass, jobject aDisplay) |
|
11869 { |
|
11870 // Note that JNI callbacks are not possible before first successfully creating jniUtils |
|
11871 JniUtils* jniUtils = NULL; |
|
11872 try { |
|
11873 jniUtils = new JniUtils(aJniEnv, aDisplay); |
|
11874 } |
|
11875 catch(...) |
|
11876 { |
|
11877 // Can't throw an exception because there's no jniUtils |
|
11878 } |
|
11879 return POINTER_TO_HANDLE( jniUtils ); |
|
11880 } |
|
11881 |
|
11882 JNIEXPORT jboolean JNICALL OS_NATIVE( JniUtils_1safeToDelete ) |
|
11883 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aQObjectHandle) |
|
11884 { |
|
11885 bool result = false; |
|
11886 SWT_TRY |
|
11887 { |
|
11888 SWT_LOG_JNI_CALL(); |
|
11889 SWT_LOG_DATA_2("handle=%x qobject=%x", aHandle, aQObjectHandle); |
|
11890 |
|
11891 HANDLE_TO_POINTER( JniUtils*, jniUtils, aHandle); |
|
11892 HANDLE_TO_POINTER( QObject*, object, aQObjectHandle ); |
|
11893 |
|
11894 result = jniUtils->safeToDelete(object); |
|
11895 } |
|
11896 SWT_CATCH |
|
11897 return result ? JNI_TRUE : JNI_FALSE; |
|
11898 } |
|
11899 |
|
11900 |
|
11901 JNIEXPORT jint JNICALL OS_NATIVE( windowServer ) |
|
11902 (JNIEnv* aJniEnv , jclass) |
|
11903 { |
|
11904 SWT_TRY |
|
11905 { |
|
11906 SWT_LOG_JNI_CALL(); |
|
11907 } |
|
11908 SWT_CATCH |
|
11909 #ifndef Q_WS_X11 |
|
11910 return 1; |
|
11911 #else |
|
11912 return 2; |
|
11913 #endif |
|
11914 } |
|
11915 |
|
11916 |
|
11917 JNIEXPORT jint JNICALL OS_NATIVE( initUiThread ) |
|
11918 (JNIEnv* |
|
11919 #ifdef __SYMBIAN32__ |
|
11920 aJniEnv |
|
11921 #endif |
|
11922 , jclass, jint |
|
11923 #ifdef __SYMBIAN32__ |
|
11924 aUid |
|
11925 #endif |
|
11926 ) |
|
11927 { |
|
11928 jint retVal = 0; |
|
11929 #ifdef __SYMBIAN32__ |
|
11930 retVal = static_cast<jint>(SymbianUtils::initUiThread(aJniEnv, static_cast<TInt>(aUid))); |
|
11931 #endif |
|
11932 return retVal; |
|
11933 } |
|
11934 |
|
11935 JNIEXPORT void JNICALL OS_NATIVE( cleanUpUiThread ) |
|
11936 (JNIEnv*, jclass) |
|
11937 { |
|
11938 #ifdef __SYMBIAN32__ |
|
11939 SymbianUtils::cleanupUiThread(); |
|
11940 #endif |
|
11941 } |
|
11942 |
|
11943 |
|
11944 JNIEXPORT void JNICALL OS_NATIVE( setSymbianAppName ) |
|
11945 #ifdef __SYMBIAN32__ |
|
11946 (JNIEnv* aJniEnv, jclass, jstring aName) |
|
11947 #else |
|
11948 (JNIEnv*, jclass, jstring) |
|
11949 #endif |
|
11950 { |
|
11951 #ifdef __SYMBIAN32__ |
|
11952 SymbianUtils::setAppName(aJniEnv, aName); |
|
11953 #endif |
|
11954 } |
|
11955 |
|
11956 JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_qt_s60_OS__1startUI |
|
11957 #ifdef __SYMBIAN32__ |
|
11958 (JNIEnv* aJniEnv, jclass, jobject aRunner, jint aUid) |
|
11959 #else |
|
11960 (JNIEnv*, jclass, jobject, jint) |
|
11961 #endif |
|
11962 { |
|
11963 jint retVal = 0; |
|
11964 #ifdef __SYMBIAN32__ |
|
11965 retVal = static_cast<jint>(SymbianUtils::startUI( aJniEnv, aRunner, aUid)); |
|
11966 #endif |
|
11967 return retVal; |
|
11968 } |
|
11969 |
|
11970 JNIEXPORT jint JNICALL OS_NATIVE( getScreenDeviceNumber ) |
|
11971 (JNIEnv*, jclass) |
|
11972 { |
|
11973 jint screenNumber = -1; |
|
11974 #ifdef __SYMBIAN32__ |
|
11975 screenNumber = SymbianUtils::GetScreenDeviceNumber(); |
|
11976 #endif |
|
11977 return screenNumber; |
|
11978 } |
|
11979 |
|
11980 JNIEXPORT jint JNICALL OS_NATIVE( getColorDepth ) |
|
11981 (JNIEnv*, jclass) |
|
11982 { |
|
11983 jint colorDepth = 24; |
|
11984 #ifdef __SYMBIAN32__ |
|
11985 colorDepth = SymbianUtils::GetColorDepth(); |
|
11986 #endif |
|
11987 return colorDepth; |
|
11988 } |
|
11989 |
|
11990 JNIEXPORT jint JNICALL OS_NATIVE( getHwInputs ) |
|
11991 (JNIEnv*, jclass) |
|
11992 { |
|
11993 jint hwInputs = 0; |
|
11994 #ifdef __SYMBIAN32__ |
|
11995 hwInputs = SymbianUtils::GetHwInputs(); |
|
11996 #endif |
|
11997 return hwInputs; |
|
11998 } |
|
11999 |
|
12000 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1new ) |
|
12001 (JNIEnv*, jclass) |
|
12002 { |
|
12003 jint handle = 0; |
|
12004 #ifdef __SYMBIAN32__ |
|
12005 handle = swtApp->initializeMobileDevice(); |
|
12006 #endif |
|
12007 return handle; |
|
12008 } |
|
12009 |
|
12010 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1createFlipWatch ) |
|
12011 #ifdef __SYMBIAN32__ |
|
12012 (JNIEnv*, jclass, jint aHandle) |
|
12013 #else |
|
12014 (JNIEnv*, jclass, jint) |
|
12015 #endif |
|
12016 { |
|
12017 #ifdef __SYMBIAN32__ |
|
12018 CSwtMobileDevice* mobileDevice = reinterpret_cast<CSwtMobileDevice*>(aHandle); |
|
12019 mobileDevice->CreateFlipWatchL(); |
|
12020 #endif |
|
12021 } |
|
12022 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1destroy ) |
|
12023 #ifdef __SYMBIAN32__ |
|
12024 (JNIEnv*, jclass, jint aHandle) |
|
12025 #else |
|
12026 (JNIEnv*, jclass, jint) |
|
12027 #endif |
|
12028 { |
|
12029 #ifdef __SYMBIAN32__ |
|
12030 swtApp->destroyMobileDevice(); |
|
12031 #endif |
|
12032 } |
|
12033 |
|
12034 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1getUserInactivityTime ) |
|
12035 #ifdef __SYMBIAN32__ |
|
12036 (JNIEnv*, jclass, jint aHandle) |
|
12037 #else |
|
12038 (JNIEnv*, jclass, jint) |
|
12039 #endif |
|
12040 { |
|
12041 jint time=0; |
|
12042 #ifdef __SYMBIAN32__ |
|
12043 CSwtMobileDevice* mobileDevice = reinterpret_cast<CSwtMobileDevice*>(aHandle); |
|
12044 time = mobileDevice->GetUserInactivityTime(); |
|
12045 #endif |
|
12046 return time; |
|
12047 } |
|
12048 |
|
12049 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1resetUserInactivityTime ) |
|
12050 #ifdef __SYMBIAN32__ |
|
12051 (JNIEnv*, jclass, jint aHandle) |
|
12052 #else |
|
12053 (JNIEnv*, jclass, jint) |
|
12054 #endif |
|
12055 { |
|
12056 #ifdef __SYMBIAN32__ |
|
12057 CSwtMobileDevice* mobileDevice = reinterpret_cast<CSwtMobileDevice*>(aHandle); |
|
12058 mobileDevice->ResetUserInactivityTime(); |
|
12059 #endif |
|
12060 } |
|
12061 |
|
12062 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1setLight ) |
|
12063 #ifdef __SYMBIAN32__ |
|
12064 (JNIEnv*, jclass, jint aHandle, jint aDuration) |
|
12065 #else |
|
12066 (JNIEnv*, jclass, jint, jint) |
|
12067 #endif |
|
12068 { |
|
12069 #ifdef __SYMBIAN32__ |
|
12070 CSwtMobileDevice* mobileDevice = reinterpret_cast<CSwtMobileDevice*>(aHandle); |
|
12071 mobileDevice->SetLights(static_cast<TInt>(aDuration)); |
|
12072 #endif |
|
12073 } |
|
12074 |
|
12075 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1flashLights ) |
|
12076 #ifdef __SYMBIAN32__ |
|
12077 (JNIEnv *, jclass, jint aHandle, jint aDuration) |
|
12078 #else |
|
12079 (JNIEnv*, jclass, jint, jint) |
|
12080 #endif |
|
12081 { |
|
12082 jboolean flashLights = JNI_FALSE; |
|
12083 #ifdef __SYMBIAN32__ |
|
12084 CSwtMobileDevice* mobileDevice = reinterpret_cast<CSwtMobileDevice*>(aHandle); |
|
12085 TRAP_IGNORE(flashLights = mobileDevice->FlashBacklightL(static_cast<TInt>(aDuration))); |
|
12086 #endif |
|
12087 return ( flashLights ? JNI_TRUE : JNI_FALSE ); |
|
12088 } |
|
12089 |
|
12090 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1vibration ) |
|
12091 #ifdef __SYMBIAN32__ |
|
12092 (JNIEnv*, jclass, jint aHandle, jint aDuration) |
|
12093 #else |
|
12094 (JNIEnv*, jclass, jint, jint) |
|
12095 #endif |
|
12096 { |
|
12097 jboolean vibraSupport = JNI_FALSE; |
|
12098 #ifdef __SYMBIAN32__ |
|
12099 CSwtMobileDevice* mobileDevice = reinterpret_cast<CSwtMobileDevice*>(aHandle); |
|
12100 vibraSupport = mobileDevice->Vibrate((TTimeIntervalMicroSeconds32)static_cast<TInt>(aDuration)); |
|
12101 #endif |
|
12102 return ( vibraSupport ? JNI_TRUE : JNI_FALSE ); |
|
12103 } |
|
12104 // Add new stuff above the Other, Other is the last category |
|
12105 |
|
12106 #ifdef __cplusplus |
|
12107 } |
|
12108 #endif |