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